Added seeking in the audio player menu and in new keystrokes (read changelog)

This commit is contained in:
2019-04-17 11:46:26 -05:00
parent 4f3bb6ac93
commit 9373f10d68
4 changed files with 26 additions and 0 deletions

View File

@@ -53,6 +53,7 @@ class audioPlayer(object):
pub.subscribe(self.stop, "stop")
pub.subscribe(self.play_next, "play-next")
pub.subscribe(self.play_previous, "play-previous")
pub.subscribe(self.seek, "seek")
def play(self, object, set_info=True, fresh=False):
""" Play an URl Stream.
@@ -181,6 +182,16 @@ class audioPlayer(object):
self.playing_track -= 1
call_threaded(self.play, self.queue[self.playing_track])
def seek(self, ms=0):
if self.check_is_playing():
if self.stream.position < 500000 and ms < 0:
self.stream.position = 0
else:
try:
self.stream.position = self.stream.position+ms
except:
pass
def check_is_playing(self):
""" check if the player is already playing a stream. """
if self.stream == None: