mplayer bug or python bug?

Marco marco at waven.com
Wed Feb 7 06:40:48 EST 2007


The following code is my test program for control mplayer.
in movies/ there are about 20 movies, the code plays them in circle,
but mplayer will crash silently after a circle, the "sliently" means I
can handle popen2 without except, but no movie.

I have no idea about it...
Can you help me?

class SimplePlayer( myobject ):
    def __init__(self):
        self.debug('simple player init ready')
        self.is_open = False
        self.wfd = None
        self.rfd = None

    def play(self, file):
        if self.is_open:
            self.wfd.write('loadfile %s\n' %(file))
            self.wfd.flush()
        else:
            self.wfd, self.rfd = os.popen2('mplayer -loop 0 -slave
-quiet -ao null %s 2> /dev/null' %(file))
            self.is_open = True


##################
if __name__ == '__main__':
    player = SimplePlayer()
    all = os.listdir('movies/')
    print all
    while True:
        for current in all:
            print current
            player.play('movies/' + current)
            time.sleep(3)

-- 
LinuX Power



More information about the Python-list mailing list