diff --git a/hugvey/central_command.py b/hugvey/central_command.py index 28e9eed..5409d7d 100644 --- a/hugvey/central_command.py +++ b/hugvey/central_command.py @@ -158,7 +158,7 @@ class CentralCommand(object): # 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'] = {} 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['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.language_code = language_code + self.future_language_code = language_code if self.google: self.google.setLanguage(language_code) diff --git a/hugvey/panopticon.py b/hugvey/panopticon.py index 5afff98..61c5c42 100644 --- a/hugvey/panopticon.py +++ b/hugvey/panopticon.py @@ -119,32 +119,40 @@ def getWebSocketHandler(central_command): self.__class__.selections[self] = int(hv_id) def msgBlock(self, hv_id): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'block'}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'block'}) def msgUnblock(self, hv_id): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'unblock'}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'unblock'}) def msgResume(self, hv_id): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'resume'}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'resume'}) def msgPause(self, hv_id): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'pause'}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'pause'}) def msgRestart(self, hv_id): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'restart'}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'restart'}) def msgFinish(self, hv_id): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'finish'}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'finish'}) def msgChangeLanguage(self, hv_id, lang_code): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language', 'lang_code': lang_code}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language', 'lang_code': lang_code}) def msgChangeLanguageForAllAvailableHugveys(self, lang_code): """ Set language for all future hugvey runs (so after a 'finish') """ for hv_id in central_command.hugveys: - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_language_if_available', 'lang_code': lang_code}) def msgSetLoopTime(self, loop_time): parts = loop_time.split(":") @@ -161,13 +169,16 @@ def getWebSocketHandler(central_command): central_command.setLoopTime(seconds) def msgChangeLightId(self, hv_id, lightId): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light', 'light_id': lightId}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light', 'light_id': lightId}) def msgChangeLightStatus(self, hv_id, status): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light_status', 'status': status}) + if central_command.hugveys[hv_id].eventQueue: + central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'change_light_status', 'status': status}) def msgPlayMsg(self, hv_id, msg_id, reloadStory): - central_command.hugveys[hv_id].eventQueue.put_nowait({'event': 'play_msg', 'msg_id': msg_id, 'reloadStory':bool(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)}) @classmethod def rmConnection(cls, client): diff --git a/hugvey/story.py b/hugvey/story.py index bad27e8..57eea02 100644 --- a/hugvey/story.py +++ b/hugvey/story.py @@ -1808,7 +1808,11 @@ class Story(object): self.logger.info("Current message: ({0}) \"{1}\"".format( message.id, message.getText())) - self.addToLog(message) + if message.id != self.story.startMessage.id: + self.addToLog(message) + else: + self.logger.debug("Not counting start message") + self.hugvey.eventLogger.info(f"message: {message.id} {message.uuid} start \"{message.getText()}\"") # TODO: prep events & timer etc. diff --git a/www/panopticon.html b/www/panopticon.html index 5343993..98e4f13 100644 --- a/www/panopticon.html +++ b/www/panopticon.html @@ -27,7 +27,7 @@ @click="showHugvey(hv)" >

- {{ hv.id }} + {{ hv.light_id }} (#{{hv.id}})

{{ hv.status }}
@@ -53,7 +53,7 @@ {{ hv.msg }}
-
+
{{ timer(hv, 'duration') }}
diff --git a/www/scss/styles.scss b/www/scss/styles.scss index dafabcf..385f16e 100644 --- a/www/scss/styles.scss +++ b/www/scss/styles.scss @@ -171,6 +171,7 @@ img.icon{ position: absolute; left: 5px; top: 5px; + font-size:150%; } .status{