Skip to content

Commit

Permalink
Vodafone.pt Grabber - fix grabbing from previous dates and 0 pad day …
Browse files Browse the repository at this point in the history
…and month
  • Loading branch information
nsenica committed Jan 14, 2025
1 parent cb0e214 commit d94b8ed
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions grab/pt_vodafone/tv_grab_pt_vodafone
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ use utf8;
use XMLTV;
use XMLTV::Version "$XMLTV::VERSION";
use DateTime;
use DateTime::Format::Strptime;
use Encode; # used to convert 'perl strings' into 'utf-8 strings'
use XML::LibXML;
use XMLTV::Configure::Writer;
Expand Down Expand Up @@ -278,10 +277,6 @@ sub get_epg

my $channelInfo = _read_channel_data();

# start the day before to fetch potential programmes that started the previous day
$curDate->add(days => -1);
my @daily_blocks = ("18-00");

while ( $curDate <= $endDate ) {

for my $channel (@channelList) {
Expand All @@ -300,11 +295,11 @@ sub get_epg

$xmlchannels{ $channelId } = \%ch ;

my $date_day = $curDate->day;
my $date_month = $curDate->month;
my $date_day = $curDate->strftime('%d');
my $date_month = $curDate->strftime('%m');
my $date_year = $curDate->year;

for my $period (@daily_blocks) {
for my $period ("00-06","06-12","12-18","18-00") {

print( STDERR "requesting EPG from " . $curDate->ymd() ." [".$period."]". " for " . $channelId . "\n" ) if( !$opt->{quiet} );
print( STDERR " GET ".$json_baseurl.$channel."/".$date_year."/".$date_month."/".$date_day."/".$period."\n" ) if( $opt->{debug} );
Expand All @@ -325,7 +320,6 @@ sub get_epg
for my $programme ( @{ $data }) {
my %prog;
my ($dtstart, $dtend, $starts_today) = make_dates($programme->{startDate}, $programme->{endDate}, $curDate);
next PROGRAMME unless $starts_today;

$prog{start} = $dtstart;
$prog{stop} = $dtend;
Expand Down Expand Up @@ -374,7 +368,6 @@ sub get_epg
}

$curDate->add(days => 1);
@daily_blocks = ("00-06","06-12","12-18","18-00");
}

$writer->write_channel($_) for values %xmlchannels;
Expand Down

0 comments on commit d94b8ed

Please sign in to comment.