Changes and fixes on the spot

This commit is contained in:
Hugvey Central Command 2019-11-12 09:54:55 +01:00
parent 2b63cde7e9
commit 1422ade597
6 changed files with 33 additions and 28 deletions

BIN
hugvey/.story.py.swp Normal file

Binary file not shown.

View File

@ -544,7 +544,7 @@ class HugveyState(object):
def getStatus(self): def getStatus(self):
return self.status return self.status
def setStatus(self, status): def setStatus(self, status, log=True):
self.status = status self.status = status
# if the story is looping, light should not go off when the story starts # if the story is looping, light should not go off when the story starts
@ -554,7 +554,8 @@ class HugveyState(object):
duration = self.command.config['light']['fade_duration_id'] duration = self.command.config['light']['fade_duration_id']
self.transitionLight(intensity, duration) self.transitionLight(intensity, duration)
self.eventLogger.info(f"status: {self.status}") if log:
self.eventLogger.info(f"status: {self.status}")
def config(self, hostname, ip): def config(self, hostname, ip):
self.ip = ip self.ip = ip
@ -721,7 +722,7 @@ class HugveyState(object):
if self.story: if self.story:
self.story.pause() self.story.pause()
self.isRunning.clear() self.isRunning.clear()
self.setStatus(self.STATE_PAUSE) self.setStatus(self.STATE_PAUSE, log=log)
def resume(self, log = True): def resume(self, log = True):
"""Start playing without reset, also used to play from a saved state""" """Start playing without reset, also used to play from a saved state"""
@ -753,12 +754,12 @@ class HugveyState(object):
self.isRunning.clear() self.isRunning.clear()
self.setStatus(self.STATE_BLOCKED) self.setStatus(self.STATE_BLOCKED)
def available(self): def available(self, log=True):
"""Put in available mode""" """Put in available mode"""
self.logger.info('Finish/Await') self.logger.info('Finish/Await')
# TODO: Toggle running if config says so, but turn light on # TODO: Toggle running if config says so, but turn light on
self.pause(log=False) self.pause(log=False)
self.setStatus(self.STATE_AVAILABLE) self.setStatus(self.STATE_AVAILABLE, log=log)
def setLightStatus(self, on): def setLightStatus(self, on):
self.lightStatus = 1 if on else 0 self.lightStatus = 1 if on else 0

View File

@ -1901,7 +1901,7 @@ class Story(object):
""" """
self.finish() self.finish()
#stop google etc: #stop google etc:
self.hugvey.available() self.hugvey.available(log=False)
def finish(self): def finish(self):
""" """

View File

@ -1,11 +1,11 @@
#N canvas 2 1094 979 475 10; #N canvas 1163 253 676 571 10;
#X obj 178 276 dac~; #X obj 178 276 dac~;
#X obj 178 226 readsf~; #X obj 178 226 readsf~;
#X obj 256 208 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 #X obj 256 208 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144
-1 -1; -1 -1;
#X text 276 205 (re-)start loop; #X text 276 205 (re-)start loop;
#X obj 399 463 netsend -u -b; #X obj 399 463 netsend -u -b;
#X obj 399 485 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 #X obj 399 485 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1; 1;
#X msg 270 333 disconnect; #X msg 270 333 disconnect;
#X obj 355 311 list prepend send; #X obj 355 311 list prepend send;
@ -18,7 +18,7 @@
#X obj 365 83 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1 #X obj 365 83 bng 15 250 50 0 empty empty empty 17 7 0 10 -262144 -1
-1; -1;
#X text 264 59 START; #X text 264 59 START;
#X obj 483 83 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 #X obj 483 83 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1; 1;
#X text 356 60 !STOP!; #X text 356 60 !STOP!;
#X text 469 59 Playing indicator; #X text 469 59 Playing indicator;
@ -26,31 +26,31 @@
#X msg 377 116 0; #X msg 377 116 0;
#X obj 355 263 oscformat /loop; #X obj 355 263 oscformat /loop;
#X msg 399 422 connect 192.168.1.174 7400; #X msg 399 422 connect 192.168.1.174 7400;
#X msg 179 169 open /mnt/stash/hugvey/sound/score40_loop_plus40s.wav
\, 1;
#X obj 99 463 netsend -u -b; #X obj 99 463 netsend -u -b;
#X obj 99 485 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 1 #X obj 99 485 tgl 15 0 empty empty empty 17 7 0 10 -262144 -1 -1 0
1; 1;
#X msg 99 419 connect 127.0.0.1 9000; #X msg 99 419 connect 127.0.0.1 9000;
#X text 393 384 Connection to Max/MSP with light; #X text 393 384 Connection to Max/MSP with light;
#X text 104 375 Connection to local python server commanding the Hugveys #X text 104 375 Connection to local python server commanding the Hugveys
; ;
#X msg 179 169 open /mnt/stash/hugvey/sound/score40_lessbass.wav \,
1;
#X connect 1 0 0 0; #X connect 1 0 0 0;
#X connect 1 0 0 1; #X connect 1 0 0 1;
#X connect 1 1 2 0; #X connect 1 1 2 0;
#X connect 2 0 12 0; #X connect 2 0 12 0;
#X connect 2 0 22 0; #X connect 2 0 27 0;
#X connect 4 0 5 0; #X connect 4 0 5 0;
#X connect 6 0 4 0; #X connect 6 0 4 0;
#X connect 6 0 23 0; #X connect 6 0 22 0;
#X connect 7 0 8 0; #X connect 7 0 8 0;
#X connect 8 0 4 0; #X connect 8 0 4 0;
#X connect 8 0 23 0; #X connect 8 0 22 0;
#X connect 9 0 1 0; #X connect 9 0 1 0;
#X connect 10 0 21 0; #X connect 10 0 21 0;
#X connect 10 0 2 0; #X connect 10 0 2 0;
#X connect 10 0 18 0; #X connect 10 0 18 0;
#X connect 10 0 25 0; #X connect 10 0 24 0;
#X connect 12 0 20 0; #X connect 12 0 20 0;
#X connect 13 0 9 0; #X connect 13 0 9 0;
#X connect 13 0 6 0; #X connect 13 0 6 0;
@ -59,6 +59,6 @@
#X connect 19 0 15 0; #X connect 19 0 15 0;
#X connect 20 0 7 0; #X connect 20 0 7 0;
#X connect 21 0 4 0; #X connect 21 0 4 0;
#X connect 22 0 1 0; #X connect 22 0 23 0;
#X connect 23 0 24 0; #X connect 24 0 22 0;
#X connect 25 0 23 0; #X connect 27 0 1 0;

View File

@ -3,3 +3,5 @@ pyaudio
coloredlogs coloredlogs
pyyaml pyyaml
pyalsaaudio pyalsaaudio
python-telegram-handler

View File

@ -5,13 +5,15 @@ var seeme = true;
var error_audio = new Audio('siren.wav'); var error_audio = new Audio('siren.wav');
var playSoundOnError = true; var playSoundOnError = true;
var checkbox_sound = document.getElementById('play_sound_on_error') var checkbox_sound = document.getElementById('play_sound_on_error')
checkbox_sound.addEventListener('change', (event) => { if(checkbox_sound != null) {
if (event.target.checked) { checkbox_sound.addEventListener('change', (event) => {
playSoundOnError = true; if (event.target.checked) {
} else { playSoundOnError = true;
playSoundOnError = false; } else {
} playSoundOnError = false;
}) }
})
}
//request close before unloading //request close before unloading
window.addEventListener('beforeunload', function(){ window.addEventListener('beforeunload', function(){
@ -177,7 +179,7 @@ class Timeline{
case 'story': case 'story':
// 'info': 'start'/'finished' // 'info': 'start'/'finished'
this.eventDataSet.add({ this.eventDataSet.add({
content: msg['type'] +': ' + msg['info'] + (msg.hasOwnProperty('args')? ': '+msg['args'] : ""), title: msg['type'] +': ' + msg['info'] + (msg.hasOwnProperty('args')? ': '+msg['args'] : ""),
start: new Date(), type: 'point', group: hv_id, 'className': 'story'}); start: new Date(), type: 'point', group: hv_id, 'className': 'story'});
break; break;
@ -187,7 +189,7 @@ class Timeline{
break; break;
default: default:
this.eventDataSet.add({ this.eventDataSet.add({
content: msg['type'] +': ' + msg['info'] + (msg.hasOwnProperty('args')? ': '+msg['args'] : ""), title: msg['type'] +': ' + msg['info'] + (msg.hasOwnProperty('args')? ': '+msg['args'] : ""),
start: new Date(), type: 'point', group: hv_id, 'className': msg['lvlname']}); start: new Date(), type: 'point', group: hv_id, 'className': msg['lvlname']});
if (msg['lvlname'] == 'CRITICAL' && playSoundOnError) { if (msg['lvlname'] == 'CRITICAL' && playSoundOnError) {
// error_audio.play(); // error_audio.play();