Changeset 0237078 for debian/lib
- Timestamp:
- Jun 24, 2010, 1:48:09 AM (14 years ago)
- Branches:
- master, debian, mac, no-cups, nodebathena, web
- Children:
- aef31c3
- Parents:
- 1e04f22
- git-author:
- root <root@…> (05/31/10 22:25:06)
- git-committer:
- Jessica B. Hamrick <jhamrick@…> (06/24/10 01:48:09)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
debian/lib/gutenbach
r4ac44b2 r0237078 31 31 32 32 my $ua = new LWP::UserAgent; 33 34 # This variable contains the pid of the child process (which runs 35 # mplayer) once it has been forked, so that we can kill it on SIGTERM 36 my $pid; 33 37 34 38 # Replace STDERR with a log file in /tmp. … … 107 111 # SIGHUP handler, in case we were aborted 108 112 sub clear_status { 113 kill 15, $pid if $pid; 109 114 my @zwrite_command = (qw(/usr/bin/zwrite -d -n -c), $zephyr_class, "-i", $queue.'@'.$host, "-s", "Gutenbach Music Spooler"); 110 115 open(ZEPH, "|-", @zwrite_command); … … 113 118 die; 114 119 } 120 115 121 $SIG{HUP} = \&clear_status; 122 $SIG{TERM} = \&clear_status; 116 123 117 124 # Read the metadata information from the file. … … 282 289 my ($filepath, $opts) = @_; 283 290 284 285 291 # Open up a zwrite command to show the mplayer output 286 292 my @zwrite_command = (qw(/usr/bin/zwrite -d -n -c), $zephyr_class, "-i", $queue.'@'.$host, "-s", "Gutenbach Music Spooler"); 287 293 288 print STDERR "Invoking @zwrite_command\n"; 289 open(ZEPHYR, "|-", @zwrite_command) or die "Couldn't launch zwrite: $!"; 294 print STDERR "Invoking (from play_mplayer_audio): @zwrite_command\n"; 290 295 291 296 # fork for mplayer 292 my$pid = open(MP3STATUS, "-|");297 $pid = open(MP3STATUS, "-|"); 293 298 unless (defined $pid) { 299 open(ZEPHYR, "|-", @zwrite_command) or die "Couldn't launch zwrite: $!"; 294 300 print ZEPHYR "Couldn't fork: $!\n"; 295 301 close(ZEPHYR); … … 299 305 if ($pid) { #parent 300 306 # Check if there were any errors 301 302 307 if ($_ = <MP3STATUS>) { 308 open(ZEPHYR, "|-", @zwrite_command) or die "Couldn't launch zwrite: $!"; 303 309 print ZEPHYR "Playback completed with the following errors:\n"; 304 310 while (<MP3STATUS>) { 305 311 print ZEPHYR $_; 306 312 } 313 close(ZEPHYR); 307 314 } else { 315 open(ZEPHYR, "|-", @zwrite_command) or die "Couldn't launch zwrite: $!"; 308 316 print ZEPHYR "Playback completed successfully.\n"; 317 close(ZEPHYR); 309 318 } 310 319 close(MP3STATUS) || print ZEPHYR "mplayer exited $?\n"; 311 312 close(ZEPHYR);313 320 } 314 321 else { # child
Note: See TracChangeset
for help on using the changeset viewer.