+ my (undef, $tmpfile) = tempfile('videosite.tmp.XXXXXXXXXXXX', DIR => $dirname);
+
+ my %saved_env;
+
+ if (exists($video->{'CONNECTOR'})) {
+ my $schemas = $video->{'CONNECTOR'}->{'schemas'};
+ foreach my $schemakey(keys(%{$schemas})) {
+ $self->debug("Setting %s_proxy to %s", $schemakey, $schemas->{$schemakey});
+ my $envkey = $schemakey.'_proxy';
+ $saved_env{ $envkey } = $ENV{ $envkey };
+ $ENV{ $envkey } = $schemas->{$schemakey};
+ }
+ }
+
+ $cookie = "-H \"Cookie: $video->{'COOKIE'}\"" if (defined $video->{'COOKIE'});
+ my $cmdline = "( GET $useragent $cookie \"$video->{'DLURL'}\" > \"$tmpfile\" && mv \"$tmpfile\" \"$dlfile\" && chmod =rw \"$dlfile\" || rm -f \"$tmpfile\" ) &";