source: web/gutenbach-web.pl @ 30beeab

debianmacno-cupsweb
Last change on this file since 30beeab 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
Line 
1use Net::CUPS;
2use Net::CUPS::Destination;
3use Image::ExifTool qw(ImageInfo);
4use CGI ':standard';
5
6use strict;
7use warnings;
8
9my $cups = Net::CUPS->new();
10
11my $printer = $cups->getDestination("buildsmp3");
12#print header();
13print start_html();
14my @jobs = $printer->getJobs( 0, 0 );
15my $job_ref;
16my $jobid;
17my $attr;
18print  <<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> 
24EOF
25foreach $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}
55print "</TBODY>\n</TABLE>";
56       
57print end_html();           
Note: See TracBrowser for help on using the repository browser.