Disable interruptions

This commit is contained in:
Ruben van de Ven 2019-05-07 14:01:37 +02:00
parent f4eb5afb46
commit fcad52da50
1 changed files with 7 additions and 17 deletions

View File

@ -1172,26 +1172,16 @@ class Story(object):
# messages that come in, in the case google is faster than our playbackFinish event.
# (if this setup doesn't work, try to test on self.lastMsgFinish time anyway)
# it keeps tricky with all these run conditions
if len(self.interruptionDiversions) and not self.currentDiversion and not self.allowReplyInterrupt:
self.logger.warn("diverge when speech during playing message")
diversion = random.choice(self.interruptionDiversions)
#: :type diversion: Diversion
r = await diversion.divergeIfNeeded(self, None)
print(r) # is always needed :-)
else:
# if len(self.interruptionDiversions) and not self.currentDiversion and not self.allowReplyInterrupt:
# self.logger.warn("diverge when speech during playing message")
# diversion = random.choice(self.interruptionDiversions)
# #: :type diversion: Diversion
# r = await diversion.divergeIfNeeded(self, None)
# print(r) # is always needed :-)
# else:
self.logger.info("ignore speech during playing message")
continue
# DEPRECATED WAY OF DOING IT:
# message is still playing:
# if self.currentMessage and not self.lastMsgFinishTime and self.previousReply and self.previousReply.forMessage.interruptCount < 4:
# timeDiff = self.timer.getElapsed() - self.previousReply.forMessage.getFinishedTime()
# if self.previousReply.forMessage.afterrunTime > timeDiff:
# #interrupt only in given interval:
# self.logger.warn("Interrupt message, replay {}".format(self.previousReply.forMessage.id))
# self.currentReply = self.previousReply
# self.previousReply.forMessage.interruptCount += 1
# self.currentMessage = await self.setCurrentMessage(self.previousReply.forMessage, self.previousReply)
# log if somebody starts speaking
if self.currentReply is None: