Changeset c5a98db for server


Ignore:
Timestamp:
Jul 5, 2010, 3:30:19 PM (14 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
master, debian, mac, no-cups, web
Children:
618236b, a81397c
Parents:
03e2535
git-author:
Jessica B. Hamrick <jhamrick@…> (07/05/10 15:30:19)
git-committer:
Jessica B. Hamrick <jhamrick@…> (07/05/10 15:30:19)
Message:
  • Fixed support for playing YouTube? videos
  • Fixed error with CUPS_SERVER in gbr and gbrm
  • Added support for playing YouTube? URLs with gbr
File:
1 edited

Legend:

Unmodified
Added
Removed
  • server/lib/gutenbach

    r30beeab rc5a98db  
    164164    # YouTube URLs are resolved by the youtube-dl command.
    165165    # Launch youtube-dl
    166     open(YTDL, "-|", "youtube-dl", "-g", $filepath) or die "Unable to invoke youtube-dl";
    167     # Read the title (currently not doing so because youtube-dl doesn't know how to get the title.
    168     my $title = ""; # <YTDL>
     166    $pid = open(YTDL, "-|");
     167    if ($pid) {
     168        print ZEPHYR "YouTube video $filepath.\nCurrently downloading, please wait...";
     169        close ZEPHYR;
     170        while (<YTDL>) {
     171            open(ZEPHYR, "|-", @zwrite_command);
     172            print ZEPHYR $_;
     173            close ZEPHYR;
     174        }
     175        open(ZEPHYR, "|-", @zwrite_command);
     176        print ZEPHYR "Done downloading.";
     177        close ZEPHYR;
     178    }
     179    else {
     180        my @args = ("youtube-dl", "-q", "-o", "/tmp/youtube.flv", $filepath);
     181        exec(@args) or die "Couldn't exec youtube-dl";
     182    }
     183
     184    $filepath = "/tmp/youtube.flv";
    169185    # Print the title to zephyr and the status string.
    170     print ZEPHYR "YouTube video $filepath\n$title";
    171     $status .= " YouTube video $filepath. $title.";
    172     # youtube-dl prints the URL of the flash video, which we pass to mplayer as a filename.
    173     $filepath = <YTDL>;
    174     chomp $filepath;
    175186  } else { # Doesn't appear to be a YouTube URL.
    176187    print STDERR "Resolved external reference to $filepath\n";
     
    253264    if (/^([^#]\S+)/) {
    254265      printf (STDERR "Found playlist line: %s\n", $_);
    255       open(LPR, "|-", 'lpr', '-P'.$queue.'@localhost', '-#', '42', '-J', $arguments->{"job-title"}, '-o', 'job-priority=100');
    256       print LPR $1;
    257       close(LPR);
     266      $ENV{CUPS_SERVER}='localhost';
     267      open(LP, "|-", "lp", "-d", "$queue", "-n", "42"); #'-#', '42', '-J', $arguments->{"job-title"}, '-o', 'job-priority=100');
     268      print LP $1;
     269      close(LP);
    258270      $i++;
    259271    }
     
    327339
    328340    my @args = (qw|/usr/bin/mplayer -vo fbdev2 -zoom -x 1024 -y 768 -framedrop -nolirc -cache 512 -ao alsa -really-quiet |, $filepath);
    329     #print STDERR "About to exec: ", Dumper([@args]);
     341    #pint STDERR "About to exec: ", Dumper([@args]);
    330342    exec(@args) ||
    331343      die "Couldn't exec";
Note: See TracChangeset for help on using the changeset viewer.