471,123 Members | 861 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,123 software developers and data experts.

mplayer bug or python bug?

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
Feb 7 '07 #1
2 1565
On Feb 7, 11:40 am, Marco <m...@waven.comwrote:
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)
Just a thought, but is mplayer writing anything to its standard output
or error streams? It may be trying to report an error! While you're
debugging, try redirecting them to logfiles.

Feb 7 '07 #2

Marco wrote:
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 had some problem with mplayer slave mode too.

everything worked ok, but after some movies i got "broken pipe"
"caught signal xy" error message on stderr and mplayer quit.

mplayer always crashed on the same files and always at the very end
(which you normally don't notice since you only want to view 1 file so
probably it has nothing to do with slave mode, but buggy mplayer +
buggy files)

my solution was: check for error and restart mplayer if it crashed (i
parsed every output so i knew where are we in the playlist)

btw if you just want to use the script to play files in loop, then
mplayer has a -loop option as well.

Feb 7 '07 #3

This discussion thread is closed

Replies have been disabled for this discussion.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.