Some changes in an attempt to fix the Panopticon crashes

This commit is contained in:
Ruben van de Ven 2019-04-16 14:45:32 +02:00
parent 7bb3410ec5
commit b2a378acfe
5 changed files with 20 additions and 3 deletions

View file

@ -159,7 +159,7 @@ class VoiceServer(object):
try: try:
if self.hugvey.cmd_server.muteMic: if self.hugvey.cmd_server.muteMic:
logger.debug('block recording {}' .format( logger.log(LOG_BS, 'block recording {}' .format(
self.hugvey.cmd_server.muteMic)) self.hugvey.cmd_server.muteMic))
# multiply by 0 to disable audio recording while playback # multiply by 0 to disable audio recording while playback

View file

@ -115,6 +115,10 @@ def getWebSocketHandler(central_command):
@classmethod @classmethod
def write_to_clients(wsHandlerClass, msg): def write_to_clients(wsHandlerClass, msg):
if msg is None:
logger.critical("Tried to send 'none' to Panopticon")
return
for client in wsHandlerClass.connections: for client in wsHandlerClass.connections:
client.write_message(msg) client.write_message(msg)

View file

@ -48,6 +48,7 @@ if __name__ == '__main__':
host = urlparse(hv.config['events']['cmd_address']).hostname host = urlparse(hv.config['events']['cmd_address']).hostname
logger.info("Connect to logger on {}".format(host)) logger.info("Connect to logger on {}".format(host))
socket_handler = logging.handlers.SocketHandler(host, 19996) # default listening address socket_handler = logging.handlers.SocketHandler(host, 19996) # default listening address
socket_handler.setLevel(logging.DEBUG) # don't send BS messages
logger.addHandler(socket_handler); logger.addHandler(socket_handler);
hv.start() hv.start()

View file

@ -40,7 +40,7 @@
</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'">
<select v-model="hv.language" @change="change_lang(hv, hv.language)"> <select v-model="hv.language" @change="change_lang(hv, hv.language)" v-on:click.stop>
<option v-for="lang in languages" :title="lang.file" <option v-for="lang in languages" :title="lang.file"
:value="lang.code"> :value="lang.code">
<span :class="['flag-icon', lang.code]"></span> <span :class="['flag-icon', lang.code]"></span>

View file

@ -45,6 +45,7 @@ class Panopticon {
return panopticon.change_language(hv.id, lang_code); return panopticon.change_language(hv.id, lang_code);
}, },
showHugvey: function(hv) { showHugvey: function(hv) {
document.body.classList.remove('showTimeline');
panopticon.hugveys.selectedId = hv.language ? hv.id : null; panopticon.hugveys.selectedId = hv.language ? hv.id : null;
panopticon.updateSelectedHugvey(); panopticon.updateSelectedHugvey();
} }
@ -127,7 +128,12 @@ class Panopticon {
}, 500); }, 500);
console.log(startDate, endDate); console.log(startDate, endDate);
this.timelineInterval = setInterval(function(){panopticon.timeline.moveTo(new Date());}, 1000); this.timelineInterval = setInterval(function(){
// skip movement if not visible
if(!document.body.classList.contains('showTimeline'))
return;
panopticon.timeline.moveTo(new Date());
}, 1000);
} }
break; break;
@ -209,6 +215,12 @@ class Panopticon {
updateSelectedHugvey() { updateSelectedHugvey() {
let hv = null; let hv = null;
if(document.body.classList.contains('showTimeline')) {
// skip at all if no hugvey is visbile anyway due to the timeline
return;
}
if(this.hugveys.selectedId) { if(this.hugveys.selectedId) {
hv = this.getHugvey(this.hugveys.selectedId); hv = this.getHugvey(this.hugveys.selectedId);
if(hv.language && this.graph.language_code != hv.language) { if(hv.language && this.graph.language_code != hv.language) {