summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPetter Reinholdtsen <pere@hungry.com>2010-02-16 13:46:17 +0000
committerPetter Reinholdtsen <pere@hungry.com>2010-02-16 13:46:17 +0000
commitf1cdc0cb061bef68d1a59551e83ceb0d4c28356e (patch)
tree93adc2aebc0193cf9d5a70b0197bd6804b0863d1
parent03af9cf27e58cc810c03f9e11a20f0dec81bf546 (diff)
Make sure to look up any video ID once to speed up the process.
-rwxr-xr-xfrikanalen/bin/check_frikanalen_future9
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) {