All pastes #945155 Raw Edit

GS42K0

public text v1 · immutable
·published 2008-03-16 18:57 UTC
rendered paste body
#!/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) { 
#       local $|=1;
        system("killall gmplayer");
        system("gmplayer  -stop-xscreensaver -skin Terminator3 -vo xv -prefer-ipv4 -playlist $ARGV[0]");
        exit;
}


open IPW, '>test-pipe' or die "can't open test-pipe $!...";
IPW->autoflush();
$/=\1024;
print IPW "New session:\n";
my $buffer_ext = 0;
while(<IPR>){
        print;
        if ($buffer_ext && /^.*(\n)?/) {
                print IPW $&;
                if(!$1) {
                        $buffer_ext = 1;
                } else {
                        $buffer_ext = 0;
                }
        }
        while (/Playing.*(\n)?/g) {
                print IPW $&;
                if(!$1) {
                        $buffer_ext = 1;
                } else {
                        $buffer_ext = 0;
                }
        }
}
print IPW "Lost the pipe...\n";
close IPW;
wait;
close IPR;
print "done";