Disable interruptions

This commit is contained in:
Ruben van de Ven 2019-05-07 14:01:37 +02:00
parent f4eb5afb46
commit fcad52da50

View file

@ -1172,26 +1172,16 @@ class Story(object):
# messages that come in, in the case google is faster than our playbackFinish event. # 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) # (if this setup doesn't work, try to test on self.lastMsgFinish time anyway)
# it keeps tricky with all these run conditions # it keeps tricky with all these run conditions
if len(self.interruptionDiversions) and not self.currentDiversion and not self.allowReplyInterrupt: # if len(self.interruptionDiversions) and not self.currentDiversion and not self.allowReplyInterrupt:
self.logger.warn("diverge when speech during playing message") # self.logger.warn("diverge when speech during playing message")
diversion = random.choice(self.interruptionDiversions) # diversion = random.choice(self.interruptionDiversions)
#: :type diversion: Diversion # #: :type diversion: Diversion
r = await diversion.divergeIfNeeded(self, None) # r = await diversion.divergeIfNeeded(self, None)
print(r) # is always needed :-) # print(r) # is always needed :-)
else: # else:
self.logger.info("ignore speech during playing message") self.logger.info("ignore speech during playing message")
continue 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 # log if somebody starts speaking
if self.currentReply is None: if self.currentReply is None: