Finish button now finishes playback also when on loop

This commit is contained in:
Ruben van de Ven 2019-08-26 15:22:40 +02:00
parent 06f1e92fcd
commit db16887c91
2 changed files with 12 additions and 2 deletions

View file

@ -491,6 +491,8 @@ class HugveyState(object):
self.lightStatus = 0
self.eventLogger = eventLogger.getChild(f"{self.id}")
self.blockRestart = False
self.setStatus(self.STATE_GONE)
self.requireRestartAfterStop = None
@ -630,6 +632,7 @@ class HugveyState(object):
if event['event'] == 'restart':
self.restart()
if event['event'] == 'finish':
self.blockRestart = True
self.story._finish() # finish story AND hugvey state
if event['event'] == 'resume':
self.resume()
@ -819,8 +822,14 @@ class HugveyState(object):
await self.story.run(startMsgId, resuming)
if self.command.config['story']['loop']:
if not self.blockRestart:
self.logger.info("Loop story")
self.restart()
else:
self.logger.info("Don't loop on manual finish")
# reset a potential setting of blockRestart
self.blockRestart = False
# self.story = None
def getStreamer(self):

View file

@ -1273,6 +1273,7 @@ class Story(object):
self.diversions = []
self.interruptionDiversions = []
self.variables = {}
self.variableValues = {} # captured variables from replies
def pause(self):
self.logger.debug('pause hugvey')