Skip to content

Commit

Permalink
Merge pull request #86 from denis-stepanov/85-error-on-unmuting-on-ti…
Browse files Browse the repository at this point in the history
…meout

Fix stop action in the case of timeout
  • Loading branch information
denis-stepanov committed May 19, 2024
2 parents 1bae40f + 0a7b775 commit 98d7e9c
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 1 addition & 1 deletion advent/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__="1.6.1b2"
__version__="1.6.1b3"
10 changes: 6 additions & 4 deletions advent/advent.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,9 @@ def startAction(self):
self.in_action = self.tvc.toggleMute()
return self.in_action

def stopAction(self):
def stopAction(self, force = False):
if force:
self.exit_jingles = 1
if self.exit_jingles > 0:
self.exit_jingles -= 1
if self.exit_jingles == 0:
Expand Down Expand Up @@ -346,10 +348,10 @@ def run(self):
while True:
if self.tv.isInAction() and self.tv.getTimeSinceLastAction() >= MUTE_TIMEOUT_TD and self.tv.OKToAct():
print('')
if self.tv.stopAction():
LOGGER.info('TV action ended due to timeout')
else:
if self.tv.stopAction(True):
LOGGER.warning('TV action rollback on timeout failed')
else:
LOGGER.info('TV action ended due to timeout')
time.sleep(1)


Expand Down

0 comments on commit 98d7e9c

Please sign in to comment.