Playlist does not advance to next song after a song is finished
Closed this issue · 1 comments
EDIT
This is related to the following bug (https://bugs.launchpad.net/ubuntu/+source/mplayer2/+bug/1191259). Ubuntu installed mplayer2 instead of mplayer and as a result this bug came up. I removed mplayer2 and installed mplayer and everything is fine now. I'm sorry for the possible confusion!
Hello,
I recently updated to Ubuntu 13.10 and I discovered that the player does not automatically advance to the next song after a song is finished. If I understand the code correctly, the player checks for every 0.5 seconds to see if 30 seconds have passed to report the song to the server. Also, it checks if mplayer returned the GLOBAL: EOF code: 1
and calls the PlayCommand._song_end_handler
, but that function is sometimes never called. Perhaps something has changed in the way mplayer works? My mplayer version is:
$ apt-cache show mplayer | grep -i version
Version: 2:1.0~rc4.dfsg1+svn34540-1ubuntu4
Here is what this part looks like now (line 163
in player.py
):
while not stop_event.is_set():
if not reported:
with write_lock:
process.write('{} get_time_pos\n'.format(pausing_keep))
stdout = process.read()
if stdout:
if 'GLOBAL: EOF code: 1' in stdout:
os.kill(os.getpid(), signal.SIGUSR1)
if not reported:
match = time_pos_rex.search(stdout)
if match and float(match.group(1)) >= 30:
os.kill(os.getpid(), signal.SIGUSR2)
reported = True
stop_event.wait(0.5)
and this is what I've changed it to:
while not stop_event.is_set():
with write_lock:
process.write('{} get_time_pos\n'.format(pausing_keep))
stdout = process.read()
if stdout:
if 'GLOBAL: EOF code: 1' in stdout:
os.kill(os.getpid(), signal.SIGUSR1)
break
match = time_pos_rex.search(stdout)
if match:
pos = float(match.group(1))
if pos == lastpos:
os.kill(os.getpid(), signal.SIGUSR1)
break
lastpos = pos
if not reported and pos >= 30:
os.kill(os.getpid(), signal.SIGUSR2)
reported = True
stop_event.wait(0.5)
I've added the check if the last position is the same as the current position, and from that I can conclude that the playback has stopped. This adds another issue - the player thinks that it should skip to the next song when it's paused.
Is there a better solution to this problem? Has anybody else experienced this?
OK, glad you got it resolved.