Changeset 38388ac for client


Ignore:
Timestamp:
Jul 5, 2010, 5:48:11 PM (14 years ago)
Author:
Jessica B. Hamrick <jhamrick@…>
Branches:
master, debian, mac, no-cups, web
Children:
b58aada
Parents:
a81397c
git-author:
Jessica B. Hamrick <jhamrick@…> (07/05/10 17:48:11)
git-committer:
Jessica B. Hamrick <jhamrick@…> (07/05/10 17:48:11)
Message:

Add support for pathname expansion/multiple files in gbr.

Location:
client/bin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • client/bin/gbr

    rc5a98db r38388ac  
    66use warnings;
    77
    8 my $usage = "Usage: gbr QUEUE FILE\n";
     8my $usage = "Usage: gbr QUEUE FILES\n";
    99
    1010my $q = $ARGV[0];
    11 my $file = $ARGV[1];
     11my @files = @ARGV[1 .. $#ARGV];
    1212
    13 if (!$q or !$file) {
     13if (!$q or !@files) {
    1414    print $usage;
    1515    exit 1
     
    3333$ENV{CUPS_SERVER}="$host";
    3434
    35 if ($file =~ m|http://www\.youtube\.com/watch\?v=|) {
    36     open(LP, "|-", "lp", "-d$queue");
    37     print LP "$file";
    38     close LP;
     35foreach my $file(@files) {
     36    if ($file =~ m|http://www\.youtube\.com/watch\?v=|) {
     37        open(LP, "|-", "lp", "-d$queue") or die "Couldn't execute lp command";
     38        print LP "$file";
     39        close LP;
     40    }
     41    else {
     42        my $pid = open(LP, "-|");
     43        if (not $pid) {
     44            my @args = ("lp", "-d$queue", "$file");
     45            exec(@args) or die "Couldn't execute lp command";
     46        }
     47    }
     48
     49    print "Sent job '$file'\n";
    3950}
    40 else {
    41     my @args = ("lp", "-d$queue", "$file");
    42     exec (@args) or die "Couldn't execute lp command";
    43 }
  • client/bin/gbr.1

    rc5a98db r38388ac  
    44.SH SYNOPSIS
    55.B gbr
    6 \fIQUEUE\fR \fIFILE\fR
     6\fIQUEUE\fR \fIFILES\fR
    77.SH DESCRIPTION
    8 Prints a file to a Gutenbach queue, given the queue name and the path
    9 to the file.  The path may also be a URL to a
     8Prints files to a Gutenbach queue, given the queue name and the path
     9to the files.  gbr correctly handles pathname expansion, so (for
     10example), if you wish to play all .mp3 files in a directory, the
     11command `gbr $queue *.mp3` will send each .mp3 as a separate job.  The
     12path may also be a URL to a
    1013.B YouTube
    1114video (e.g. http://www.youtube.com/watch?v=foo).  The Gutenbach queue
Note: See TracChangeset for help on using the changeset viewer.