]> git.pld-linux.org Git - packages/clive.git/blobdiff - clive-delfi.patch
- updated for 2.1.10
[packages/clive.git] / clive-delfi.patch
index 8c792415ae30d81086354f73214bdae152c07582..080ef9d39a3e3eeb42c9ad6035e2f8284517d194 100644 (file)
@@ -1,43 +1,42 @@
---- clive-2.1.0/clive  2008-12-11 20:19:25.263179888 +0200
-+++ clive-2.1.0-delfi/clive    2008-12-11 23:03:43.000000000 +0200
-@@ -84,6 +84,7 @@
-     IsBreak     => qr|\Qbreak.com\E|i,
-     IsLastfm    => qr|\Qlast.fm\E|i,
-     IsLiveleak  => qr|\Qliveleak.com\E|i,
-+    IsDelfi     => qr|\Q.delfi.\E|i,
-     #IsMetacafe => qr|\Qmetacafe.com\E|i,
- );
-@@ -303,6 +304,8 @@
-         ($xurl, $id, $title) = handle_break($response_ref);
-     } elsif ( $url =~ /$re_hosts{IsLiveleak}/ ) {
-         ($xurl, $id) = handle_liveleak($response_ref, $response_fh);
-+    } elsif ( $url =~ /$re_hosts{IsDelfi}/ ) {
-+        ($xurl, $id) = handle_delfi($response_ref, $response_fh);
-     }
- #    elsif ( $url =~ /$re_hosts{IsMetacafe}/ ) {
- #        ($xurl, $id) = handle_metacafe($response_ref);
-@@ -712,6 +715,64 @@
+--- clive-2.1.10/clive~ 2009-04-27 11:14:37.000000000 +0200
++++ clive-2.1.10/clive  2009-04-27 11:21:15.000000000 +0200
+@@ -87,6 +87,7 @@
+                  IsEvisor    => qr|evisor.tv|i,
+                  IsDmotion   => qr|dailymotion.com|i,
+                  IsCctv      => qr|tv.cctv.com|i,
++                 IsDelfi     => qr|.delfi.|i,
+                );
+
+ my @re_hosts_arr = (
+@@ -99,6 +100,7 @@
+                     [$re_hosts{IsEvisor},    \&handle_evisor],
+                     [$re_hosts{IsDmotion},   \&handle_dmotion],
+                     [$re_hosts{IsCctv},      \&handle_cctv],
++                    [$re_hosts{IsDelfi},     \&handle_delfi],
+                    );
+
+ # Parse config              
+@@ -992,6 +993,64 @@
      return ($xurl, $id);
  }
  
 +sub handle_delfi {
 +    my ($response_ref, $response_fh) = @_;
-+
++ 
 +    my %re = (
-+      # videobox
-+      # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=15218215
++    # videobox
++    # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=15218215
 +        GrabVideoboxURL => qr|flv_url:\s*'(.*?)'|,
-+      # videoproject embed
-+      # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=18759038
++    # videoproject embed
++    # http://www.delfi.ee/news/paevauudised/paevavideo/article.php?id=18759038
 +        GrabVideoSalt   => qr|_delfiVideoSalt\s*=\s*"([^"]+)";|,
 +        GrabVideoSite   => qr|src="(\S+://[^/]+)/js/embed.js"|,
-+      # videoproject
-+      # http://video.delfi.ee/video/CzurzqNz/
-+              GrabVideoURL   => qr|\.addVariable\('file',\s*'([^']+)'|,
++    # videoproject
++    # http://video.delfi.ee/video/CzurzqNz/
++        GrabVideoURL   => qr|\.addVariable\('file',\s*'([^']+)'|,
 +    );
 +
-+      my ($xurl, $id);
++    my ($xurl, $id);
 +    my $videobox_url = $1 if $$response_ref =~ /$re{GrabVideoboxURL}/;
 +    my $video_salt   = $1 if $$response_ref =~ /$re{GrabVideoSalt}/;
 +    my $video_site   = $1 if $$response_ref =~ /$re{GrabVideoSite}/;
 +
 +    if ($videobox_url) {
 +        $id = $1 if $videobox_url =~ m{/([^/]+)\.flv$};
-+              $xurl = $videobox_url;
++        $xurl = $videobox_url;
 +
-+      } elsif ($video_url) {
-+        $xurl = uri_unescape($video_url);
++    } elsif ($video_url) {
++        $xurl = URI::Escape::uri_unescape($video_url);
 +        $id = $1 if $xurl =~ m{^\S+://[^/]+/v/(.+?)\.flv};
 +
 +    } elsif ($video_salt and $video_site) {
-+              my $url = $video_site . '/video/' . $video_salt . '/';
-+              print "done.\nfetch page ..." unless $opts{quiet};
++        my $url = $video_site . '/video/' . $video_salt . '/';
++        print "done.\nfetch page ..." unless $opts{quiet};
 +
-+              my $page = "";
-+              open my $fh, ">", \$page;
++        my $page = "";
++        open my $fh, ">", \$page;
 +
-+              # Disable: header
-+              $curl->setopt(CURLOPT_HEADER, 0);
-+              $curl->setopt(CURLOPT_URL, $url);
-+              $curl->setopt(CURLOPT_WRITEDATA, $fh);
++        # Disable: header
++        $curl->setopt(CURLOPT_HEADER, 0);
++        $curl->setopt(CURLOPT_URL, $url);
++        $curl->setopt(CURLOPT_WRITEDATA, $fh);
 +
-+              my $rc = $curl->perform;
-+              close $fh;
++        my $rc = $curl->perform;
++        close $fh;
 +
-+              if ($rc == 0) {
-+                      # recurse
-+                      ($xurl, $id) = handle_delfi(\$page);
-+              } else {
-+                      print STDERR "\nerror: " . $curl->strerror($rc) . " (http/$rc)\n";
-+              }
-+      } else {
++        if ($rc == 0) {
++            # recurse
++            ($xurl, $id) = handle_delfi(\$page);
++        } else {
++            print STDERR "\nerror: " . $curl->strerror($rc) . " (http/$rc)\n";
++        }
++    } else {
 +        print STDERR "error: url not found\n";
 +    }
 +
 +    return ($xurl, $id);
 +}
 +
  # Subroutines: Progress
  # NOTE: the 'dot' progress copies much from wget.
This page took 0.09543 seconds and 4 git commands to generate.