Remove debugging output
[videosite.git] / videosite / AsyncWgetFileGetter.pm
index 43366a3..d52a2ef 100644 (file)
@@ -1,6 +1,7 @@
 # (c) 2007 by Ralf Ertzinger <ralf@camperquake.de>
-#     2008-2009,2011 by Christian Garbs <mitch@cgarbs.de>
+#     2008-2009,2011-2012 by Christian Garbs <mitch@cgarbs.de>
 #     2010 by Maximilian Rehkopf <otakon@gmx.net>
+#
 # licensed under GNU GPL v2
 #
 # A getter which will download the media to a local file storage
@@ -35,6 +36,7 @@ sub get {
     my $dlfile;
     my $dirname;
     my $cookie = "";
+    my $useragent = "--user-agent=Mozilla/5.0";
 
     $dlfile = sprintf($self->_getval('FILEPATTERN'),
         $self->_encode($video->{'SOURCE'}),
@@ -43,6 +45,8 @@ sub get {
         $self->_encode($video->{'DLURL'}),
         $self->_encode($video)->{'URL'});
 
+    $dlfile =~ s/([\\"])/\\$1/g;
+
     $dirname = dirname($dlfile);
     if ($self->_diskfree($dirname) < $self->_getval('MINFREE')) {
         $self->error("Not enough free space to download");
@@ -66,7 +70,7 @@ sub get {
     }
     
     $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\" ) &";
+    my $cmdline = "( wget -q -O\"$tmpfile\" $useragent $cookie \"$video->{'DLURL'}\" && mv \"$tmpfile\" \"$dlfile\" && chmod =rw \"$dlfile\" && touch \"$dlfile\" || rm -f \"$tmpfile\" ) &";
     $self->debug("Going to execute: %s", $cmdline);
     system($cmdline);