Duration only from last speech and other updates to panopticon
This commit is contained in:
parent
31d62a9710
commit
7cf2cca16e
5 changed files with 32 additions and 15 deletions
|
@ -158,7 +158,7 @@ class CentralCommand(object):
|
||||||
# status['history'] = hv.story.getLogSummary() # disabled as it is a bit slow. We now have eventLog
|
# status['history'] = hv.story.getLogSummary() # disabled as it is a bit slow. We now have eventLog
|
||||||
# status['counts'] = {t: len(a) for t, a in status['history'].items() if t != 'directions' }
|
# status['counts'] = {t: len(a) for t, a in status['history'].items() if t != 'directions' }
|
||||||
status['counts'] = {} if not hv.story else hv.story.getLogCounts()
|
status['counts'] = {} if not hv.story else hv.story.getLogCounts()
|
||||||
status['duration'] = 0 if not hv.story else (hv.story.timer.getElapsed('first_speech') if hv.story.timer.hasMark('first_speech') else hv.story.timer.getElapsed())
|
status['duration'] = None if not hv.story else (hv.story.timer.getElapsed('first_speech') if hv.story.timer.hasMark('first_speech') else None)
|
||||||
status['has_state'] = Story.hugveyHasSavedState(hv.lightId)
|
status['has_state'] = Story.hugveyHasSavedState(hv.lightId)
|
||||||
status['variables'] = {} if not isSelected or not hv.story else hv.story.variableValues
|
status['variables'] = {} if not isSelected or not hv.story else hv.story.variableValues
|
||||||
|
|
||||||
|
@ -735,6 +735,7 @@ class HugveyState(object):
|
||||||
|
|
||||||
self.logger.info(f"set language: {language_code}")
|
self.logger.info(f"set language: {language_code}")
|
||||||
self.language_code = language_code
|
self.language_code = language_code
|
||||||
|
self.future_language_code = language_code
|
||||||
|
|
||||||
if self.google:
|
if self.google:
|
||||||
self.google.setLanguage(language_code)
|
self.google.setLanguage(language_code)
|
||||||
|
|
|
@ -119,24 +119,31 @@ def getWebSocketHandler(central_command):
|
||||||
self.__class__.selections[self] = int(hv_id)
|
self.__class__.selections[self] = int(hv_id)
|
||||||
|
|
||||||
def msgBlock(self, hv_id):
|
def msgBlock(self, hv_id):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'block'})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'block'})
|
||||||
|
|
||||||
def msgUnblock(self, hv_id):
|
def msgUnblock(self, hv_id):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'unblock'})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'unblock'})
|
||||||
|
|
||||||
def msgResume(self, hv_id):
|
def msgResume(self, hv_id):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'resume'})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'resume'})
|
||||||
|
|
||||||
def msgPause(self, hv_id):
|
def msgPause(self, hv_id):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'pause'})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'pause'})
|
||||||
|
|
||||||
def msgRestart(self, hv_id):
|
def msgRestart(self, hv_id):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'restart'})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'restart'})
|
||||||
|
|
||||||
def msgFinish(self, hv_id):
|
def msgFinish(self, hv_id):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'finish'})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'finish'})
|
||||||
|
|
||||||
def msgChangeLanguage(self, hv_id, lang_code):
|
def msgChangeLanguage(self, hv_id, lang_code):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language', 'lang_code': lang_code})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language', 'lang_code': lang_code})
|
||||||
|
|
||||||
def msgChangeLanguageForAllAvailableHugveys(self, lang_code):
|
def msgChangeLanguageForAllAvailableHugveys(self, lang_code):
|
||||||
|
@ -144,6 +151,7 @@ def getWebSocketHandler(central_command):
|
||||||
Set language for all future hugvey runs (so after a 'finish')
|
Set language for all future hugvey runs (so after a 'finish')
|
||||||
"""
|
"""
|
||||||
for hv_id in central_command.hugveys:
|
for hv_id in central_command.hugveys:
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code})
|
||||||
|
|
||||||
def msgSetLoopTime(self, loop_time):
|
def msgSetLoopTime(self, loop_time):
|
||||||
|
@ -161,12 +169,15 @@ def getWebSocketHandler(central_command):
|
||||||
central_command.setLoopTime(seconds)
|
central_command.setLoopTime(seconds)
|
||||||
|
|
||||||
def msgChangeLightId(self, hv_id, lightId):
|
def msgChangeLightId(self, hv_id, lightId):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light', 'light_id': lightId})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light', 'light_id': lightId})
|
||||||
|
|
||||||
def msgChangeLightStatus(self, hv_id, status):
|
def msgChangeLightStatus(self, hv_id, status):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light_status', 'status': status})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light_status', 'status': status})
|
||||||
|
|
||||||
def msgPlayMsg(self, hv_id, msg_id, reloadStory):
|
def msgPlayMsg(self, hv_id, msg_id, reloadStory):
|
||||||
|
if central_command.hugveys[hv_id].eventQueue:
|
||||||
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'play_msg', 'msg_id': msg_id, 'reloadStory':bool(reloadStory)})
|
central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'play_msg', 'msg_id': msg_id, 'reloadStory':bool(reloadStory)})
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|
|
@ -1808,7 +1808,11 @@ class Story(object):
|
||||||
|
|
||||||
self.logger.info("Current message: ({0}) \"{1}\"".format(
|
self.logger.info("Current message: ({0}) \"{1}\"".format(
|
||||||
message.id, message.getText()))
|
message.id, message.getText()))
|
||||||
|
if message.id != self.story.startMessage.id:
|
||||||
self.addToLog(message)
|
self.addToLog(message)
|
||||||
|
else:
|
||||||
|
self.logger.debug("Not counting start message")
|
||||||
|
|
||||||
self.hugvey.eventLogger.info(f"message: {message.id} {message.uuid} start \"{message.getText()}\"")
|
self.hugvey.eventLogger.info(f"message: {message.id} {message.uuid} start \"{message.getText()}\"")
|
||||||
|
|
||||||
# TODO: prep events & timer etc.
|
# TODO: prep events & timer etc.
|
||||||
|
|
|
@ -27,7 +27,7 @@
|
||||||
@click="showHugvey(hv)"
|
@click="showHugvey(hv)"
|
||||||
>
|
>
|
||||||
<h1>
|
<h1>
|
||||||
{{ hv.id }}
|
{{ hv.light_id }} <span v-if="hv.id != hv.light_id">(#{{hv.id}})</span>
|
||||||
</h1>
|
</h1>
|
||||||
<div class='status'>{{ hv.status }}</div>
|
<div class='status'>{{ hv.status }}</div>
|
||||||
<div v-if="hv.status != 'off' && hv.status != 'gone' && hv.status != 'loading'">
|
<div v-if="hv.status != 'off' && hv.status != 'gone' && hv.status != 'loading'">
|
||||||
|
@ -53,7 +53,7 @@
|
||||||
<img class='icon' src="/images/icon-position.svg" title="position">
|
<img class='icon' src="/images/icon-position.svg" title="position">
|
||||||
{{ hv.msg }}
|
{{ hv.msg }}
|
||||||
</div>
|
</div>
|
||||||
<div class='timer'>
|
<div class='timer' v-if="hv.duration">
|
||||||
<img class='icon' src="/images/icon-clock.svg" title="timer">
|
<img class='icon' src="/images/icon-clock.svg" title="timer">
|
||||||
{{ timer(hv, 'duration') }}
|
{{ timer(hv, 'duration') }}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -171,6 +171,7 @@ img.icon{
|
||||||
position: absolute;
|
position: absolute;
|
||||||
left: 5px;
|
left: 5px;
|
||||||
top: 5px;
|
top: 5px;
|
||||||
|
font-size:150%;
|
||||||
}
|
}
|
||||||
|
|
||||||
.status{
|
.status{
|
||||||
|
|
Loading…
Reference in a new issue