Actions
Feature #1357
openxxv 1.7.0 EPG einlesen beschleunigt
Start date:
05/02/2013
Due date:
% Done:
0%
Estimated time:
Description
2 neue Features dazu :
- Begrenzung der einzulesenden Kanäle fürs EPG ( z.B. bis kanal 1000 )
- Begrenzung der Tage im EPG ( z.B. ARD 7 Tage statt 4 Wochen )
1 Bereinigung :
- SQL_NO_CACHE statt SQL_CACHE
Geschwindigkeitsteigerung ( bei 60 Kanälen EPG gegenüber 600 ) 3 Minuten gegenüber 15 Minuten updateEPG
--- ./pure_xxv/xxv/lib/XXV/MODULES/CHANNELS.pm 2013-05-02 14:09:23.151693783 +0200
+++ ./xxv/xxv/lib/XXV/MODULES/CHANNELS.pm 2013-05-02 11:27:29.783527788 +0200
@@ -771,6 +771,18 @@
}
# ------------------
+sub NameToPos {
+# ------------------
+ my $self = shift || return error('No object defined!');
+ my $name = shift || return undef;
+
+ my $sth = $self->{dbh}->prepare('SELECT SQL_CACHE pos from CHANNELS where name = ?');
+ $sth->execute($name)
+ or return error sprintf("Couldn't execute query: %s.",$sth->errstr);
+ my $erg = $sth->fetchrow_hashref();
+ return $erg ? $erg->{pos} : undef;
+}
+# ------------------
sub PosToChannel {
# ------------------
my $self = shift || return error('No object defined!');
--- ./pure_xxv/xxv/etc/xxvd.cfg.example 2013-05-02 14:09:23.059693321 +0200
+++ ./xxv/xxv/etc/xxvd.cfg.example 2013-05-02 14:48:54.779454048 +0200
@@ -17,6 +17,8 @@
interval=3600
periods=12:00,18:00,20:20,22:00,23:00,00:00,02:00,04:00
timeframe=2
+daysinfuture=14
+skipchannels=1000
[GRAB]
font=VeraBI.ttf
--- ./pure_xxv/xxv/lib/XXV/MODULES/EPG.pm 2013-05-02 14:09:23.151693783 +0200
+++ ./xxv/xxv/lib/XXV/MODULES/EPG.pm 2013-05-02 13:57:48.112247265 +0200
@@ -29,6 +29,7 @@
type => 'integer',
required => gettext('This is required!'),
},
+
periods => {
description => gettext("Preferred program times. (eg. 12:00, 18:00)"),
default => '12:00,18:00,20:15,22:00',
@@ -43,6 +44,18 @@
required => gettext('This is required!'),
level => 'guest'
},
+ daysinfuture => {
+ description => gettext('How deep in future the EPG should be read (in days)'),
+ default => 7,
+ type => 'integer',
+ required => gettext('This is required!'),
+ },
+ skipchannels => {
+ description => gettext('until which Position of Channels will be read)'),
+ default => 10000,
+ type => 'integer',
+ required => gettext('This is required!'),
+ },
},
Commands => {
search => {
@@ -264,7 +278,12 @@
panic ("Couldn't get modul SVDRP");
return 0;
}
-
+ $self->{channels} = main::getModule ('CHANNELS'); # clist
+ unless($self->{channels}) {
+ panic ("Couldn't get modul CHANNELS");
+ return 0;
+ }
+
$self->startReadEpgData();
# Restart interval every x hours
@@ -416,6 +435,11 @@
my $channelname;
my $hostname = $self->{svdrp}->hostname($vid);
+ # read only epg until $self->{daysinfuture} days in the future ( prevent to read full 4 Weeks EPG from some German Broadcasters )
+ my $now = time ;
+ my $some_days = 60 * 60 * 24 * $self->{daysinfuture} ;
+ my $in_some_days = $now + $some_days ;
+
while($count < scalar $vdata) {
($vdrData,$channel,$channelname,$count) = $self->readEpgData($vid,$vdata,$count);
last if(not $channel);
@@ -423,8 +447,12 @@
$waiter->next($count,undef, sprintf(gettext("Analyze channel '%s'"), $channelname))
if(ref $waiter);
+ ## use only channels lower pos $self->{skipchannels}
+ my $ergpos = $self->{channels}->NameToPos("$channelname"); # pos of channel from CHANNELS
+ next if ( $ergpos >= $self->{skipchannels} );
+
# First - read database
- my $sql = qq|SELECT SQL_CACHE eventid, title, subtitle, length(description) as ldescription, duration, UNIX_TIMESTAMP(starttime) as starttime, UNIX_TIMESTAMP(vpstime) as vpstime, video, audio, content from EPG where vid = ? and channel_id = ? |;
+ my $sql = qq|SELECT SQL_NO_CACHE eventid, title, subtitle, length(description) as ldescription, duration, UNIX_TIMESTAMP(starttime) as starttime, UNIX_TIMESTAMP(vpstime) as vpstime, video, audio, content from EPG where vid = ? and channel_id = ? |;
my $sth = $self->{dbh}->prepare($sql);
$sth->execute($vid, $channel)
or return error sprintf("Couldn't execute query: %s.",$sth->errstr);
@@ -432,14 +460,21 @@
lg sprintf("Compare EPG Database with data from %s : %d / %d for channel '%s' - %s", $hostname, scalar keys %$db_data,scalar keys %$vdrData, $channelname, $channel);
# Compare this Hashes
+
+
+
+
+
foreach my $eid (keys %{$vdrData}) {
my $row = $vdrData->{$eid};
-
+ next if ( $row->{starttime} >= $in_some_days );
+
# Exists in DB .. update
if(exists $db_data->{$eid}) {
# Compare fields
+
foreach my $field (qw/title subtitle ldescription duration starttime vpstime video audio content/) {
- next if(not exists $row->{$field} or not $row->{$field});
+ next if(not exists $row->{$field} or not $row->{$field});
if((not exists $db_data->{$eid}->{$field})
or (not $db_data->{$eid}->{$field})
or ($db_data->{$eid}->{$field} ne $row->{$field})) {
@@ -720,7 +755,7 @@
);
my $sql = qq|
- SELECT SQL_CACHE
+ SELECT SQL_NO_CACHE
e.eventid as \'$f{'id'}\',
e.title as \'$f{'title'}\',
e.subtitle as __Subtitle,
@@ -821,7 +856,7 @@
my $config = shift || return error('No config defined!');
my $cid = shift;
unless($cid) {
- my $c = $self->{dbh}->selectrow_arrayref("SELECT SQL_CACHE hash from CHANNELS order by vid, pos limit 1");
+ my $c = $self->{dbh}->selectrow_arrayref("SELECT SQL_NO_CACHE hash from CHANNELS order by vid, pos limit 1");
return $console->err(gettext("No channel available!"))
unless($c && $c->[0]);
$cid = $c->[0];
@@ -849,7 +884,7 @@
);
my $sql = qq|
-SELECT SQL_CACHE
+SELECT SQL_NO_CACHE
e.eventid as \'$f{'id'}\',
e.title as \'$f{'title'}\',
e.subtitle as __Subtitle,
@@ -971,7 +1006,7 @@
foreach my $table (qw/EPG OLDEPG/) {
my $sql = qq|
-SELECT SQL_CACHE
+SELECT SQL_NO_CACHE
e.eventid as \'$f{'Id'}\',
e.title as \'$f{'Title'}\',
e.subtitle as \'$f{'Subtitle'}\',
@@ -1129,7 +1164,7 @@
);
my $sql =
qq|
-SELECT SQL_CACHE
+SELECT SQL_NO_CACHE
e.eventid as \'$f{'Service'}\',
e.title as \'$f{'Title'}\',
e.subtitle as __Subtitle,
@@ -1285,7 +1320,7 @@
);
my $sql =
qq|
-SELECT SQL_CACHE
+SELECT SQL_NO_CACHE
e.eventid as \'$f{'Service'}\',
e.title as \'$f{'Title'}\',
e.subtitle as __Subtitle,
@@ -1431,7 +1466,7 @@
my $sql =
qq|
-SELECT SQL_CACHE
+SELECT SQL_NO_CACHE
e.eventid as Service,
e.title as Title,
e.subtitle as Subtitle,
@@ -1539,7 +1574,7 @@
my $sql =
qq|
-SELECT SQL_CACHE
+SELECT SQL_NO_CACHE
e.eventid as Service,
e.title as Title,
e.subtitle as __Subtitle,
@@ -1649,7 +1684,7 @@
my $eid = shift || return con_err($console, gettext('No event id defined!'));
my $sql = qq|
-SELECT SQL_CACHE
+SELECT SQL_NO_CACHE
e.starttime,
ADDDATE(e.starttime, INTERVAL e.duration SECOND) as stoptime,
LEFT(c.Source,1) as source,
@@ -1752,7 +1787,7 @@
}
my $sql = qq|
- SELECT SQL_CACHE
+ SELECT SQL_NO_CACHE
e.title as title
FROM
EPG as e,
Files
No data to display
Actions