diff options
| author | ivan <ivan> | 2003-06-25 12:13:50 +0000 |
|---|---|---|
| committer | ivan <ivan> | 2003-06-25 12:13:50 +0000 |
| commit | 4d94dfdf5171220e62511e48de6f36b97d5eadfb (patch) | |
| tree | f96aa3c6cfb7db5c2b2d45915c0e14778d2e6e81 /yashout | |
| parent | 7d0906c0b1eb4df0a66371268317e07802abaa2b (diff) | |
Diffstat (limited to 'yashout')
| -rw-r--r-- | yashout | 26 |
1 files changed, 24 insertions, 2 deletions
@@ -12,8 +12,11 @@ use strict; use subs qw(daemonize); +use POSIX qw(:sys_wait_h setsid); use Shout; +my $encoder_password = 'haze420'; + #read options from commandline my($filename, $mountpoint, $port) = @ARGV; @@ -21,21 +24,40 @@ my $conn = new Shout ( ip => 'localhost', port => $port || 8000, mount => $mountpoint, + password => $encoder_password, icy_compat => 0, dumpfile => undef, name => 'Fonestream audio', url => 'http://www.fonestream.com/', genre => 'talk', description => 'The easiest way to webcast.', - bitrate => 64, + bitrate => 16, ispublic => 0, ); $conn->connect or die "Failed to connect: ". $conn->error; +open(SFILE,"</home/ivan/plexmp3/silence.mp3") or die "Can't open silence.mp3: $!"; open(FILE,"<$filename") or die "Can't open $filename: $!"; daemonize(); #fork/disconnect so plex.pls will return to client +if ( 0 ) { + + #send silence header to server + my( $sbuffer, $sbytes ) = ( '', 0 ); + while ( ( $sbytes = read( SFILE, $sbuffer, 4096 ) ) > 0 ) { + $conn->sendData( $sbuffer ) && next; + # error handling??? + print STDERR "Error while sending: ", $conn->error, "\n"; + last; + } continue { + $conn->sleep; + } + +} + +sleep 10; + #spool file to server my( $buffer, $bytes ) = ( '', 0 ); while ( ( $bytes = read( FILE, $buffer, 4096 ) ) > 0 ) { @@ -55,7 +77,7 @@ sub daemonize { defined(my $pid = fork) or die "Can't fork: $!"; if ( $pid ) { #print "yashout started with pid $pid\n"; #logging to $log_file\n"; - exit unless $pid_file; + #exit unless $pid_file; #my $pidfh = new IO::File ">$pid_file" or exit; #print $pidfh "$pid\n"; exit; |
