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()
|
self.player.play()
|
||||||
|
|
||||||
def playing(self):
|
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:
|
if self.player:
|
||||||
return self.player.is_playing()
|
if self.player.get_position() > 0 and self.player.is_playing():
|
||||||
else:
|
return True
|
||||||
return False
|
|
||||||
|
return False
|
||||||
|
|
||||||
def set_position(self, ms):
|
def set_position(self, ms):
|
||||||
"Set current play time in milliseconds from start"
|
"Set current play time in milliseconds from start"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user