Fix resume playback for extended context menu

This commit is contained in:
croneter 2018-01-28 12:52:31 +01:00
parent 6e6fbadb02
commit 906f61a847

View file

@ -414,21 +414,23 @@ class SpecialMonitor(Thread):
def run(self): def run(self):
LOG.info("----====# Starting Special Monitor #====----") LOG.info("----====# Starting Special Monitor #====----")
player = Player() player = Player()
# "Start from beginning", "Play from beginning"
strings = (getLocalizedString(12021), getLocalizedString(12023))
while not self.thread_stopped(): while not self.thread_stopped():
is_playing = player.isPlaying() is_playing = player.isPlaying()
if (not is_playing and if (not is_playing and
getCondVisibility('Window.IsVisible(DialogContextMenu.xml)') and getCondVisibility('Window.IsVisible(DialogContextMenu.xml)') and
getInfoLabel('Control.GetLabel(1002)') == getLocalizedString(12021)): getInfoLabel('Control.GetLabel(1002)') in strings):
# Remember that the item IS indeed resumable # Remember that the item IS indeed resumable
state.RESUMABLE = True state.RESUMABLE = True
control = int(Window(10106).getFocusId()) control = int(Window(10106).getFocusId())
if control == 1002: if control == 1002:
# Start from beginning # Start from beginning
LOG.info("Resume dialog: Start from beginning selected")
state.RESUME_PLAYBACK = False state.RESUME_PLAYBACK = False
else: elif control == 1001:
LOG.info("Resume dialog: resume selected")
state.RESUME_PLAYBACK = True state.RESUME_PLAYBACK = True
sleep(200) else:
# User chose something else from the context menu
state.RESUME_PLAYBACK = False
sleep(100)
LOG.info("#====---- Special Monitor Stopped ----====#") LOG.info("#====---- Special Monitor Stopped ----====#")