lapsule / python-mplayer

Automatically exported from code.google.com/p/python-mplayer
GNU Lesser General Public License v3.0
1 stars 0 forks source link

program hangs after quit and send query #1

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What steps will reproduce the problem?
#---eg.
from mplayer import Player
import time

p = Player()
p.start()
p.loadfile('...any file...')
while p.is_alive():
    time.sleep(1)  # at the moment you press 'q' so quit mplayer
    print p.filepath   # the program hangs at this point

#---end eg.
timeout is not working, self._stdout._file is not None
I simply add line 306 in core.py:
'if not self.is_alive(): return None'
may be is a better solution to this problem

Original issue reported on code.google.com by ddarko...@gmail.com on 29 Dec 2010 at 7:22

GoogleCodeExporter commented 8 years ago
Hi, thanks for filing a bug report.
However, I can't reproduce this. What version are you using?

Original comment by daru...@gmail.com on 7 Jan 2011 at 2:41

GoogleCodeExporter commented 8 years ago
I can reproduce this problem.  It looks like if mplayer dies after 
self.is_alive() but before the read, something like this bit from core.py goes 
into and endless loop:

                while True:
                    response = self._proc.stdout.readline().decode().rstrip()
                    print 'response:', response, self.is_alive()
                    if response.startswith('ANS_'):
                        break

Note the extra print I put in there, with my script that looks like this:
#!/usr/bin/python
import mplayer
f = '/home/nexus/test.mp4'

p = mplayer.Player()
p.loadfile(f)
while True:
  print p.stream_pos

I get this output when I run the script then hit 'q' inside the mplayer window:
response: ANS_stream_pos=283841 True
283841
response: ANS_stream_pos=283841 True
283841
response:  True
response: Exiting... (Quit) True
response:  True
response:  True
response:  True
response:  True
response:  True
response:  True
.....
response:  True
response:  True
response:  False
response:  False
response:  False
response:  False
response:  False
response:  False
response:  False
response:  False
response:  False

.... 

endless loop... have to kill with C-c

Oddly enough, I thought the set of flags used:  -input nodefault-bindings 
-noconfig all  would prevent things like hitting 'q' inside the window.

This is with Ubunut Lucid which is running a relatively ancient mplayer:
MPlayer SVN-r1.0~rc3+svn20090426-4.4.3 (C) 2000-2009 MPlayer Team

Once I get in front my home computer where I have mplayer from head, I'll give 
this another try.

Original comment by dalg...@gmail.com on 23 Jul 2011 at 8:55

GoogleCodeExporter commented 8 years ago
Hi,

That might be a bug with the latest release, 0.6.0. I/O with MPlayer has been 
overhauled in the latest code in hg; I recommend that you use that.

Original comment by daru...@gmail.com on 24 Jul 2011 at 1:14

GoogleCodeExporter commented 8 years ago
Using the latest code from the repo, I can't reproduce the behavior you 
described. Like I said in my previous comment, I/O with MPlayer has been 
overhauled for the upcoming 0.7.0 release. Please use 0.7.0 instead.

Original comment by daru...@gmail.com on 28 Aug 2011 at 3:28