- Timestamp:
- Jul 5, 2010, 8:01:47 PM (14 years ago)
- Branches:
- master, debian, mac, no-cups, web
- Children:
- d768767
- Parents:
- 38388ac
- git-author:
- Jessica B. Hamrick <jhamrick@…> (07/05/10 20:01:47)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (07/05/10 20:01:47)
- Location:
- client/bin
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
client/bin/gbq
r30beeab rb58aada 38 38 39 39 print "Queue listing for queue '$queue' on '$host'\n\n"; 40 print "Job ID\t\tOwner\t\t File\n";40 print "Job ID\t\tOwner\t\tTitle\n"; 41 41 print "-----------------------------------------------------------------\n"; 42 42 -
client/bin/gbr
r38388ac rb58aada 5 5 use strict; 6 6 use warnings; 7 8 use Net::CUPS; 9 use Net::CUPS::Destination; 10 use Image::ExifTool qw(ImageInfo); 7 11 8 12 my $usage = "Usage: gbr QUEUE FILES\n"; … … 31 35 } 32 36 33 $ENV{CUPS_SERVER}="$host"; 37 my $cups = Net::CUPS->new(); 38 $cups->setServer("$host"); 39 my $printer = $cups->getDestination("$queue"); 40 my ($jobid, $title); 34 41 35 42 foreach my $file(@files) { 36 43 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; 44 open FILE, ">", "/tmp/gutenbach-youtube\n" or die "Couldn't create temporary file"; 45 print FILE $file; 46 $title = $file; 47 $file = "/tmp/gutenbach-youtube"; 48 $printer->addOption("copies", 42); 40 49 } 41 50 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"; 51 my $fileinfo = ImageInfo($file); 52 my $magic = $fileinfo->{FileType}; 53 54 if ($magic) { 55 $title = $fileinfo->{'Title'}." - ".$fileinfo->{'Artist'}." - ".$fileinfo->{'Album'}; 56 } 57 else { 58 $title = $file; 46 59 } 47 60 } 48 61 49 print "Sent job '$file'\n"; 62 $jobid = $printer->printFile($file, $title); 63 64 if ($jobid) { 65 print "Sent job '$title' (id $jobid)\n"; 66 } 67 else { 68 print "Error sending job '$title'\n"; 69 } 50 70 } -
client/bin/gbrm
ra81397c rb58aada 34 34 } 35 35 36 my @args; 36 my $cups = Net::CUPS->new(); 37 $cups->setServer("$host"); 38 my $printer = $cups->getDestination("$queue"); 39 my @jobs = $printer->getJobs(0, 0); 37 40 38 41 if ($id eq "all") { 39 @args = ("cancel", "-a", "$queue"); 42 foreach $id(@jobs) { 43 $printer->cancelJob($id); 44 } 40 45 } 41 46 elsif ($id eq "current") { 42 my $cups = Net::CUPS->new(); 43 $cups->setServer("$host"); 44 my $printer = $cups->getDestination("$queue"); 45 my @jobs = $printer->getJobs(0, 0); 46 my $id = $jobs[0]; 47 @args = ("cancel", "$id", "$queue"); 47 $id = $jobs[0]; 48 $printer->cancelJob($id); 48 49 } 49 50 else { 50 @args = ("cancel", "$id", "$queue");51 $printer->cancelJob($id); 51 52 } 52 $ENV{CUPS_SERVER}="$host";53 exec (@args) or die "Couldn't execute cancel command";
Note: See TracChangeset
for help on using the changeset viewer.