diff options
-rwxr-xr-x | frikanalen/bin/check_frikanalen_future | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/frikanalen/bin/check_frikanalen_future b/frikanalen/bin/check_frikanalen_future index 53d9f48..0f11259 100755 --- a/frikanalen/bin/check_frikanalen_future +++ b/frikanalen/bin/check_frikanalen_future @@ -21,6 +21,7 @@ use SOAP::Lite on_action => sub {sprintf '%s/%s', @_}, ; my $listref = get_epglist(); my $retval = 0; +my %eventcache; for my $url (@{$listref}) { my $ua = new LWP::UserAgent; my $req = new HTTP::Request GET => $url; @@ -42,7 +43,13 @@ for my $url (@{$listref}) { # from the @events array. if ($event->{'start'} && $event->{'contentId'}) { my $videoId = $event->{'contentId'}; - my $metaref = get_video_meta($event->{'contentId'}); + my $metaref; + if (exists $eventcache{$videoId}) { + $metaref = $eventcache{$videoId}; + } else { + $metaref = get_video_meta($event->{'contentId'}); + $eventcache{$videoId} = $metaref; + } my $title = $event->{'title'}; my $org = $event->{'organisation'}; unless ($metaref) { |