All pastes #945671 Raw Edit

GS42K0

public text v1 · immutable
·published 2008-03-17 02:44 UTC
rendered paste body
#!/usr/bin/perl -w
# csmplayer (c) dion.rasmussen@gmail.com

use IO::Handle;

# fork a player control process to write
my $info_pipe_pid = open IPR, '-|';

IPR->autoflush();

die "can't open stdout" unless defined $info_pipe_pid;
if(!$info_pipe_pid) { 
	system("killall gmplayer");
	system("gmplayer  -stop-xscreensaver -skin Terminator3 -vo xv -prefer-ipv4 -quiet -playlist $ARGV[0]");
	exit;
}


open IPW, '>test-pipe' or die "can't open test-pipe $!...";
IPW->autoflush();
print IPW "New session:\n";
my $cut_id;
while(<IPR>){
	print;
	if( /^Playing/ ){
		# append to the player_log ;)
		print IPW;

		# open firefox/osd for gangsterfreak info
		if( /(http:\/\/[^\/]+)\/cut\/(\d+)/ && $2 != $cut_id && `pidof firefox-bin`) {
			$cut_id = $2;
			system "firefox $1/uf/$cut_id";
		}
	} 
}
print IPW "Lost the pipe...\n";
close IPW;
wait;
close IPR;
print "done";