debianmacno-cupsweb
|
Last change
on this file since c5a98db was
c5a98db,
checked in by Jessica B. Hamrick <jhamrick@…>, 15 years ago
|
- Fixed support for playing YouTube? videos
- Fixed error with CUPS_SERVER in gbr and gbrm
- Added support for playing YouTube? URLs with gbr
|
-
Property mode set to
100755
|
|
File size:
725 bytes
|
| Line | |
|---|
| 1 | #!/usr/bin/perl |
|---|
| 2 | |
|---|
| 3 | # Written by Jessica Hamrick (C) 2010 |
|---|
| 4 | |
|---|
| 5 | use strict; |
|---|
| 6 | use warnings; |
|---|
| 7 | |
|---|
| 8 | my $usage = "Usage: gbr QUEUE FILE\n"; |
|---|
| 9 | |
|---|
| 10 | my $q = $ARGV[0]; |
|---|
| 11 | my $file = $ARGV[1]; |
|---|
| 12 | |
|---|
| 13 | if (!$q or !$file) { |
|---|
| 14 | print $usage; |
|---|
| 15 | exit 1 |
|---|
| 16 | } |
|---|
| 17 | |
|---|
| 18 | my $configpath = "$ENV{'HOME'}/.gutenbach/$q"; |
|---|
| 19 | if (! -e $configpath) { |
|---|
| 20 | print "Queue '$q' does not exist!\n"; |
|---|
| 21 | exit 1; |
|---|
| 22 | } |
|---|
| 23 | |
|---|
| 24 | my ($host, $queue); |
|---|
| 25 | |
|---|
| 26 | if (-r $configpath) { |
|---|
| 27 | local $/; |
|---|
| 28 | my $fh; |
|---|
| 29 | open $fh, $configpath; |
|---|
| 30 | eval <$fh>; |
|---|
| 31 | } |
|---|
| 32 | |
|---|
| 33 | $ENV{CUPS_SERVER}="$host"; |
|---|
| 34 | |
|---|
| 35 | if ($file =~ m|http://www\.youtube\.com/watch\?v=|) { |
|---|
| 36 | open(LP, "|-", "lp", "-d$queue"); |
|---|
| 37 | print LP "$file"; |
|---|
| 38 | close LP; |
|---|
| 39 | } |
|---|
| 40 | else { |
|---|
| 41 | my @args = ("lp", "-d$queue", "$file"); |
|---|
| 42 | exec (@args) or die "Couldn't execute lp command"; |
|---|
| 43 | } |
|---|
Note: See
TracBrowser
for help on using the repository browser.