- fix vimeo grabber
authorRalf Ertzinger <sun@lain.camperquake.de>
Sat, 2 Aug 2008 18:56:40 +0000 (20:56 +0200)
committerRalf Ertzinger <sun@lain.camperquake.de>
Sat, 2 Aug 2008 18:56:40 +0000 (20:56 +0200)
videosite/VimeoGrabber.pm

index d09f4b2..b293ed8 100644 (file)
@@ -57,18 +57,22 @@ sub _parse {
         return undef;
     }
 
-    # There is no XML header in the data, which makes XML::Simple unhappy
-    $content = '<?xml version="1.0" encoding="UTF-8"?>' . $content;
-
     unless(defined($t = $p->XMLin($content, KeepRoot => 1))) {
         $self->error('Could not parse XML metadata');
         return undef;
     }
 
-    $dlurl = $t->{'xml'}->{'video'}->{'hd_file'} || $t->{'xml'}->{'video'}->{'file'};
+    if (exists($t->{'xml'}->{'video'}->{'is_hd'}) and (0 != $t->{'xml'}->{'video'}->{'is_hd'})) {
+        $self->debug('Selecting HD video');
+        $dlurl = $t->{'xml'}->{'video'}->{'hd_file'};
+    } else {
+        $self->debug('Selecting SD video');
+        $dlurl = $t->{'xml'}->{'video'}->{'file'};
+    }
     $timestamp = $t->{'xml'}->{'timestamp'};
 
     unless(defined($dlurl)) {
+        $self->error('No dlurl found in XML');
         return undef;
     }
 
@@ -79,6 +83,7 @@ sub _parse {
         $timestamp += 1800;
         $hash = md5_hex(sprintf('redFiretruck%s?e=%d', $dlpath, $timestamp));
     } else {
+        $self->error('Unknown dlurl scheme: %s', $dlurl);
         return undef;
     }