diff options
author | Petter Reinholdtsen <pere@hungry.com> | 2010-02-07 12:40:49 +0000 |
---|---|---|
committer | Petter Reinholdtsen <pere@hungry.com> | 2010-02-07 12:40:49 +0000 |
commit | 852be563e41b1e2c25920501098ccc353714fcbb (patch) | |
tree | 204b4fc23888222d5bf3ee8ae54d743d7e3cbfd5 | |
parent | 55e870f313352acff0dc7ad240c9b6d3ba058176 (diff) |
Only download once.
-rwxr-xr-x | frikanalen/bin/scheduler | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/frikanalen/bin/scheduler b/frikanalen/bin/scheduler index 850b00b..a0dd3fe 100755 --- a/frikanalen/bin/scheduler +++ b/frikanalen/bin/scheduler @@ -116,7 +116,7 @@ for my $url (@{$listref}) { # Download only if ($opts{'g'}) { - $downloadreq{$event->{'broadcasturl'}} = 1; + $downloadreq{$event->{'broadcasturl'}} = $videoId; next; } @@ -141,8 +141,14 @@ for my $url (@{$listref}) { if ($opts{'g'}) { for my $url (keys %downloadreq) { - print "info: Downloading '$url'\n"; - system("wget", $url); + my $id = $downloadreq{$url}; + my $filename = "broadcast-$id.avi"; + if ( ! -f $filename) { + print "info: Downloading '$url'.\n"; + system("wget", "-nv", "-O", $filename, $url); + } else { + print "info: Not downloading '$url', file $filename exist.\n"; + } } exit 0; } |