Changeset 600e713


Ignore:
Timestamp:
Aug 16, 2010, 8:15:05 PM (14 years ago)
Author:
Kyle Brogle <broglek@…>
Branches:
master, debian, mac, no-cups
Children:
04a6a66
Parents:
9dee329
git-author:
Kyle Brogle <broglek@…> (08/16/10 20:15:05)
git-committer:
Kyle Brogle <broglek@…> (08/16/10 20:15:05)
Message:

[Trac #12] Youtube urls now stream instead of downloading to the server.

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • client/bin/gbr

    r7cdd65d r600e713  
    5252foreach my $file(@files) {
    5353    if ($file =~ m|http://www\.youtube\.com/watch\?v=|) {
    54         open FILE, ">", "/tmp/gutenbach-youtube\n" or die "Couldn't create temporary file";
     54        open FILE, ">", "/tmp/gutenbach-youtube" or die "Couldn't create temporary file";
    5555        print FILE $file;
    5656        $title = $file;
  • server/lib/gutenbach

    r79fac02 r600e713  
    174174    # YouTube URLs are resolved by the youtube-dl command.
    175175    # Launch youtube-dl
    176     $pid = open(YTDL, "-|");
    177     if ($pid) {
    178         print ZEPHYR "YouTube video $filepath.\nCurrently downloading, please wait...";
    179         close ZEPHYR;
    180         while (<YTDL>) {
    181             open(ZEPHYR, "|-", @zwrite_command);
    182             print ZEPHYR $_;
    183             close ZEPHYR;
    184         }
    185         open(ZEPHYR, "|-", @zwrite_command);
    186         print ZEPHYR "Done downloading.";
    187         close ZEPHYR;
    188     }
    189     else {
    190         my @args = ("youtube-dl", "-q", "-o", "/tmp/youtube.flv", $filepath);
    191         exec(@args) or die "Couldn't exec youtube-dl";
    192     }
    193 
    194     $filepath = "/tmp/youtube.flv";
    195     # Print the title to zephyr and the status string.
     176    $pid = open(YTDL, "-|", "youtube-dl","-b", "-g", $filepath) or die "Unable to invoke youtube-dl";
     177        print ZEPHYR "YouTube video $filepath\n$title";
     178        $status .= " YouTube video $filepath. $title.";
     179        # youtube-dl prints the URL of the flash video, which we pass to mplayer as a filename.
     180        $filepath = <YTDL>;
     181        chomp $filepath;
     182
     183
    196184  } else { # Doesn't appear to be a YouTube URL.
    197185    print STDERR "Resolved external reference to $filepath\n";
Note: See TracChangeset for help on using the changeset viewer.