#!/usr/bin/perl -w # 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 -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; my $sshalt_pid; while(){ print; if( /^Playing/ ){ # kill the screensaver-halt if ($sshalt_pid) { kill 15, $sshalt_pid; wait; undef $sshalt_pid; } # 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"; } } elsif (/^VIDEO/) { $sshalt_pid = fork; if (!$sshalt_pid) { warn "going to inhibit the screen-saver"; exec 'gnome-screensaver-command -i'; exit; } } } close IPW; wait; close IPR; kill 15, $sshalt_pid if $sshalt_pid; wait; print "done";