From db16887c913e757655e0012f4c7bba364b2952df Mon Sep 17 00:00:00 2001 From: Ruben van de Ven Date: Mon, 26 Aug 2019 15:22:40 +0200 Subject: [PATCH] Finish button now finishes playback also when on loop --- hugvey/central_command.py | 13 +++++++++++-- hugvey/story.py | 1 + 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hugvey/central_command.py b/hugvey/central_command.py index 9ed2cf3..0487b63 100644 --- a/hugvey/central_command.py +++ b/hugvey/central_command.py @@ -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']: - self.logger.info("Loop story") - self.restart() + 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): diff --git a/hugvey/story.py b/hugvey/story.py index c3fac7d..aee72be 100644 --- a/hugvey/story.py +++ b/hugvey/story.py @@ -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')