Improve detecting when track is playing.
This commit is contained in:
parent
b049f3207d
commit
0c041d0bf6
14
app/music.py
14
app/music.py
@ -86,12 +86,18 @@ class Music:
|
||||
self.player.play()
|
||||
|
||||
def playing(self):
|
||||
"Return True if currently playing a track, else False"
|
||||
"""
|
||||
Return True if currently playing a track, else False
|
||||
|
||||
vlc.is_playing() returns True if track was faded out.
|
||||
get_position seems more reliable.
|
||||
"""
|
||||
|
||||
if self.player:
|
||||
return self.player.is_playing()
|
||||
else:
|
||||
return False
|
||||
if self.player.get_position() > 0 and self.player.is_playing():
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
def set_position(self, ms):
|
||||
"Set current play time in milliseconds from start"
|
||||
|
||||
Loading…
Reference in New Issue
Block a user