Changeset ab55f2e for gutenbach/debian
- Timestamp:
- Feb 22, 2004, 11:50:57 AM (21 years ago)
- Branches:
- master, debian, mac, no-cups, nodebathena, web
- Children:
- d414b9c
- Parents:
- 53d7625
- git-author:
- arolfe <arolfe> (02/22/04 11:50:57)
- git-committer:
- arolfe <arolfe> (02/22/04 11:50:57)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
gutenbach/debian/lib/sipbmp3-filter
r53d7625 rab55f2e 2 2 # Play the data on STDIN as an audio file 3 3 # 4 # $Id: sipbmp3-filter,v 1.1 1 2003-10-24 20:31:42 jtwangExp $4 # $Id: sipbmp3-filter,v 1.12 2004-02-22 16:50:57 arolfe Exp $ 5 5 # $Source: /tmp/tmp.UFBNno9997/RCS/sipbmp3-filter,v $ 6 6 # … … 478 478 479 479 # Play an OggVorbis audio stream (doesn't support auth!) 480 # play_ogg_stream(URI, userpass) 480 # play_ogg_stream(URI) 481 # Mostly copied from play_ogg_audio 481 482 sub play_ogg_stream { 482 483 my $uri = shift(@_); 483 my $userpass = shift(@_);484 484 485 485 system("chmod a+rw /dev/audio"); … … 489 489 # Prepare to write status: 490 490 open(ZEPHYR, '|/usr/athena/bin/zwrite -d -n -c sipb-auto -i sipbmp3@xcb -s "SIPB LPR music spooler"'); 491 492 # fork for ogg123 493 my $pid = open(OGGSTATUS, "-|"); 494 unless (defined $pid) { 495 print ZEPHYR "Couldn't fork: $!\n"; 496 close(ZEPHYR); 497 return; 498 } 499 if ($pid) { # parent 500 # Check if there were any errors 501 if ($_ = <OGGSTATUS>) { 502 print ZEPHYR "Playback completed with the following errors:\n"; 503 print ZEPHYR $_; 504 while (<OGGSTATUS>) { 505 print ZEPHYR $_; 506 } 507 } else { 508 print ZEPHYR "Playback completed successfully.\n"; 509 } 510 close(OGGSTATUS) || print ZEPHYR "ogg123 exited $?\n"; 511 512 close(ZEPHYR); 513 } 514 else { #child 515 # redirect STDERR to STDOUT 516 open STDERR, '>&STDOUT'; 517 exec("/mit/sipb/bin/ogg123","-b40000","-dau","-q","-f","-",$uri) || 518 die "Couldn't exec"; 519 } 491 system("/mit/sipb/bin/ogg123 -b 40000 -dau -q -f - $uri 2> /tmp/ogg123.out | audioplay"); 492 493 # Check if there were any errors 494 open(OGGSTATUS, "/tmp/ogg123.out"); 495 if ($_ = <OGGSTATUS>) { 496 print ZEPHYR "Playback completed with the following errors:\n"; 497 print ZEPHYR $_; 498 while (<OGGSTATUS>) { 499 print ZEPHYR $_; 500 } 501 } else { 502 print ZEPHYR "Playback completed successfully.\n"; 503 # Repeat tag data for those playing at home 504 if (!$ogginfo{'title'}) { 505 print ZEPHYR "No ogginfo data found\n"; 506 print ZEPHYR "Filename: $opts{'J'}\n\n"; 507 } else { 508 print ZEPHYR "Title : $ogginfo{'title'}\n"; 509 print ZEPHYR "Artist : $ogginfo{'artist'}\n"; 510 print ZEPHYR "Album : $ogginfo{'album'}\n"; 511 print ZEPHYR "Track # : $ogginfo{'tracknumber'}\n"; 512 513 # others 514 while (($key,$val) = each %lessinfo) { 515 printf ZEPHYR "%-15s: %s\n", $key, $val; 516 } 517 } 518 } 519 520 close(OGGSTATUS); 521 unlink(OGGSTATUS); 522 523 close(ZEPHYR); 520 524 } 521 525
Note: See TracChangeset
for help on using the changeset viewer.