debianmacno-cupsweb
Last change
on this file since 335786f was
30beeab,
checked in by Jessica B. Hamrick <jhamrick@…>, 14 years ago
|
Remove "gutenbach-" from directory names and rename "gutenbach" to "gutenbach-server"
|
-
Property mode set to
100755
|
File size:
1.3 KB
|
Rev | Line | |
---|
[3947653] | 1 | use Net::CUPS; |
---|
| 2 | use Net::CUPS::Destination; |
---|
| 3 | use Image::ExifTool qw(ImageInfo); |
---|
| 4 | use CGI ':standard'; |
---|
| 5 | |
---|
| 6 | use strict; |
---|
| 7 | use warnings; |
---|
| 8 | |
---|
| 9 | my $cups = Net::CUPS->new(); |
---|
| 10 | |
---|
| 11 | my $printer = $cups->getDestination("buildsmp3"); |
---|
| 12 | #print header(); |
---|
| 13 | print start_html(); |
---|
| 14 | my @jobs = $printer->getJobs( 0, 0 ); |
---|
| 15 | my $job_ref; |
---|
| 16 | my $jobid; |
---|
| 17 | my $attr; |
---|
| 18 | print <<EOF; |
---|
| 19 | <TABLE SUMMARY="Job List"> |
---|
| 20 | <THEAD> |
---|
| 21 | <TR><TH> USER</TH><TH>TITLE</TH><TH>ARTIST</TH><TH>ALBUM</TH></TR> |
---|
| 22 | </THEAD> |
---|
| 23 | <TBODY> |
---|
| 24 | EOF |
---|
| 25 | foreach $jobid(@jobs) |
---|
| 26 | { |
---|
| 27 | $job_ref = $printer->getJob($jobid); |
---|
| 28 | #print "$job_ref->{ 'id' }\t\t$job_ref->{ 'user'}\t\t$job_ref->{ 'title' }\n"; |
---|
| 29 | my $filepath = "/var/spool/cups/d00$job_ref->{ 'id' }-001"; |
---|
| 30 | my $fileinfo = ImageInfo($filepath); |
---|
| 31 | my $magic = $fileinfo->{FileType}; |
---|
| 32 | #print"$job_ref->{ 'user' } is playing:\n"; |
---|
| 33 | print "<TR VALIGN=\"TOP\">"; |
---|
| 34 | print "<TD>$job_ref->{ 'user'}</TD>\n"; |
---|
| 35 | if($magic) |
---|
| 36 | { |
---|
| 37 | # print "MAGIC"; |
---|
| 38 | if (exists $fileinfo->{'Title'}) { |
---|
| 39 | printf("<TD>%s</TD>\n", $fileinfo->{'Title'}); |
---|
| 40 | } |
---|
| 41 | foreach my $key (qw/Artist Album AlbumArtist/) { |
---|
| 42 | if (exists $fileinfo->{$key}) { |
---|
| 43 | printf("<TD>%s</TD>\n", $fileinfo->{$key}) if exists $fileinfo->{$key}; |
---|
| 44 | |
---|
| 45 | } |
---|
| 46 | } |
---|
| 47 | } |
---|
| 48 | else |
---|
| 49 | { |
---|
| 50 | print "<TD>$job_ref->{ 'title' }</TD><TD></TD><TD></TD> \n"; |
---|
| 51 | } |
---|
| 52 | print "</TR>"; |
---|
| 53 | |
---|
| 54 | } |
---|
| 55 | print "</TBODY>\n</TABLE>"; |
---|
| 56 | |
---|
| 57 | print end_html(); |
---|
Note: See
TracBrowser
for help on using the repository browser.