add connector support to AsyncFileGetter
[videosite.git] / videosite / AsyncWgetFileGetter.pm
index ef54e92..8f04656 100644 (file)
@@ -53,6 +53,14 @@ sub get {
 
     my (undef, $tmpfile) = tempfile('videosite.tmp.XXXXXXXXXXXX', DIR => $dirname);
 
+    if (exists($video->{'CONNECTOR'})) {
+       my $schemas = $video->{'CONNECTOR'}->{'schemas'};
+       foreach (keys(%{$schemas})) {
+           $self->debug("Setting %s_proxy to %s", $_, $schemas->{$_});
+           $ENV{ $_.'_proxy'} = $schemas->{$_};
+       }
+    }
+
     $cookie = "--header=\"Cookie: $video->{'COOKIE'}\"" if (defined $video->{'COOKIE'});
     my $cmdline = "( wget -q -O\"$tmpfile\" $cookie \"$video->{'DLURL'}\" && mv \"$tmpfile\" \"$dlfile\" && chmod =rw \"$dlfile\" && touch \"$dlfile\" || rm -f \"$tmpfile\" ) &";
     $self->debug("Going to execute: %s", $cmdline);