Commit d273782e authored by nextime's avatar nextime

Added input type feedback and buttons

parent 51ee691c
[General]
log_file = /tmp/streaming_control.log
log_level = INFO
log_level = DEBUG
[Web]
stream_url = https://192.168.42.1/HLS/record/Live.m3u8
......@@ -29,6 +29,20 @@ port = 4455
password = motorol4
[INPUT:doubleleeloo]
obs = leeloo
scene = LIVE SFW
source = 6
[INPUT:doublestefy]
obs = slut
scene = live SFW
source = 6
[INPUT:doubleshine]
obs = slut
scene = SHINE
source = 7
# OUTPUT are shenes on OBS sending to a specific stream, can be a rtmp stream with
# OBS multistream plugin or a virtual cam, both the included in OBS or the ones
......@@ -43,6 +57,7 @@ status.close.enable = 5,4
status.tease.disable = 4
status.tease.enable = 5,3
[OUTPUT:smstefy]
obs = slut
scene = live SFW
......@@ -72,21 +87,44 @@ status.tease.enable = 4,3
# BUTTON:<rownum>:<button_name>
[BUTTON:1:private_shine]
title = Private Shine
action = private_shine
color = maroon
#[BUTTON:1:private_shine]
#title = Private Shine
#action = private_shine
#color = maroon
#[BUTTON:1:private_stefy]
#title = Private Stefy
#action = private_stefy
#color = maroon
#[BUTTON:1:private_leelo]
#title = Private Leeloo
#action = private_leeloo
#color = maroon
[BUTTON:1:private_stefy]
title = Private Stefy
action = private_stefy
color = maroon
[BUTTON:1:Doubles_shine]]
title = Double SHINE
action = double_shine
input = doubleshine
color = gray
color.enabled = blue
[BUTTON:1:Double_stefy]]
title = DOUBLE STEFY
action = double_stefy
input = doublestefy
color = gray
color.enabled = blue
[BUTTON:1:double_leeloo]]
title = DOUBLE LEELOO
action = double_leeloo
input = doubleleeloo
color = gray
color.enabled = blue
[BUTTON:1:private_leelo]
title = Private Leeloo
action = private_leeloo
color = maroon
[BUTTON:1:open_all]]
title = Open ALL
......@@ -126,6 +164,11 @@ color.open = green
color.tease = orange
color = grey
[BUTTON:2:spotify]
title = MUSIC PAUSE
action = spotify_pause
color = blue
#[BUTTON:2:leelo_livejasmine]
#title = Open/Close JASM
#action = jasmine_openclose
......@@ -134,21 +177,29 @@ color = grey
title = SCENE Tease ALL
action = tease_all
color = teal
color.active = turquoise
feedback = scene
[BUTTON:3:tease]
title = SCENE Tease
action = tease
color = teal
color.active = turquoise
feedback = scene
[BUTTON:3:scene_all_open]
title = SCENE ALL OPEN
action = open_all
color = teal
color.active = turquoise
feedback = scene
[BUTTON:3:scene_shile_always_open]
title = SCENE SHINE ALWAYS OPEN
action = open_all
action = open_all_shine_open
color = teal
color.active = turquoise
feedback = scene
[BUTTON:3:scene_manual]
title = MANUAL
......@@ -165,6 +216,9 @@ feedback = status
setstatus = change
[ACTION:spotify_pause]
execute = /home/nextime/bin/spotifypause
[ACTION:private_shine]
execute = /usr/local/bin/smblur_private
......@@ -177,6 +231,20 @@ execute = /usr/local/bin/smblur_private_leeloo
#[ACTION:private_jasmine]
#execute = /usr/local/bin/smblur_private_jasmin
[ACTION:double_shine]
execute = /usr/local/bin/smdouble_shine
setscene = double
[ACTION:double_stefy]
execute = /usr/local/bin/smdouble_stefy
setscene = double
[ACTION:double_leeloo]
execute = /usr/local/bin/smdouble_leeloo
setscene = double
[ACTION:leelo_openclose]
execute = /usr/local/bin/smblur_leeloo
......@@ -191,10 +259,16 @@ execute = /usr/local/bin/smblur_stefy
[ACTION:tease_all]
execute = /usr/local/bin/smblur_teaseall
setscene = tease_all
[ACTION:tease]
execute = /usr/local/bin/smblur_tease
setscene = tease
[ACTION:open_all]
execute = /usr/local/bin/smblur_clean
setscene = open_all
[ACTION:open_all_shine_open]
execute = /usr/local/bin/smblur_clean
setscene = open_all_shine_open
......@@ -26,6 +26,29 @@ obws_logger.setLevel(logging.CRITICAL)
logger = logging.getLogger(__name__)
class OBSInput:
def __init__(self, inp, config_section, obss):
self.config_section = config_section
self.inp = inp
self.status = False
self.obss = obss
self.config_options = config.options(config_section)
self.config_section = config_section
for c in self.config_options:
setattr(self, c, config.get(config_section, c))
def getStatus(self):
return self.obss.getInputStatus(self.scene, self.source)
def updateStatus(self):
status = self.getStatus()
if status != self.status:
self.status = status
logging.info('INPUT '+self.inp+" FOUND "+str(self.status))
self.obss.queue.put({ 'event': 'INPUTSTATUSCHANGE', 'data': {'server': self.obss.server, 'input': self.inp, 'status': self.status }})
class OBSOutput:
def __init__(self, output, config_section, obss):
......@@ -37,6 +60,7 @@ class OBSOutput:
self.config_section = config_section
self.statuses = {}
self.inputs = {}
self.inpmon = []
for c in self.config_options:
if 'status.' in c:
for inp in config.get(config_section, c).split(','):
......@@ -53,8 +77,9 @@ class OBSOutput:
'enable': enabled,
}
setattr(self, c, config.get(config_section, c))
logging.debug(self.statuses)
logging.debug(self.inputs)
#print(getattr(self, 'source.closed'))
#print(dir(self))
......@@ -104,6 +129,11 @@ class OBSOutput:
self.status = self.updateStatus()
return self.status
def getInput(self, inp):
if inp in self.inputs.keys():
return self.obss.getInputStatus(self.scene, inp)
return False
class OBSControl:
def __init__(self, obs_server, config_section):
......@@ -186,6 +216,14 @@ def run_obs_controller():
logging.info('OUTPUT '+config.get(k, 'obs')+" -> "+k.split(":",1)[1])
logging.info(obs_outputs[k.split(":",1)[1]].getStatus())
obs_inputs = {}
for k in [x for x in config.sections() if 'INPUT:' in x]:
obss = False
if config.get(k, 'obs') in obs_servers.keys():
obss = obs_servers[config.get(k, 'obs')]
obs_inputs[k.split(":",1)[1]] = OBSInput(k.split(":",1)[1], k, obss )
#cl = obs.EventClient(host='192.168.42.115', port=4455, password='motorol4')
#cr = obs.ReqClient(host='192.168.42.115', port=4455, password='motorol4')
......@@ -223,6 +261,12 @@ def run_obs_controller():
for output in obs_outputs.values():
if output.obss.server == data['server'] and output.scene==data['scene'] and str(data['source']) in output.inputs.keys():
output.updateStatus()
for inp in obs_inputs.values():
if inp.obss.server == data['server'] and inp.scene==data['scene'] and str(data['source'])==str(inp.source):
inp.updateStatus()
if event == 'INPUTSTATUSCHANGE':
logging.info("INPUTSTATUSCHANGE: input "+data['input']+ " on obs "+data['server']+" is now "+str(data['status']))
qcore.put(task)
if event == 'OUTPUTCHANGE':
#{ 'event': 'OUTPUTCHANGE', 'data': {'server': self.obss.server, 'output': self.output, 'status': self.status }}
logging.info("OUTPUTCHANGE: output "+data['output']+ " on obs "+data['server']+" is now "+str(data['status']))
......
......@@ -94,6 +94,7 @@ def create_panel_gui():
row = 1
bframes = {}
outputs = {}
inputs = {}
feedbacks = {}
while row <= numrows:
# create the frame for this row
......@@ -121,6 +122,9 @@ def create_panel_gui():
if 'output' in buttons[row][b].keys():
outputs[buttons[row][b]['output']] = {'btn': button, 'cfg': buttons[row][b]}
elif 'input' in buttons[row][b].keys():
inputs[buttons[row][b]['input']] = {'btn': button, 'cfg': buttons[row][b]}
elif 'feedback' in buttons[row][b].keys():
if not buttons[row][b]['feedback'] in feedbacks.keys():
feedbacks[buttons[row][b]['feedback']] = [{'btn': button, 'cfg': buttons[row][b]}]
......@@ -158,6 +162,15 @@ def create_panel_gui():
btn.config(bg=bcfg['color.'+str(data['status'])])
if 'title.'+str(data['status']) in bcfg.keys():
btn.config(text=bcfg['title.'+str(data['status'])])
if event == 'INPUTSTATUSCHANGE':
if data['input'] in inputs.keys():
logging.info('CHANGE THE COLOR OF THE BUTTON FOR '+str(data['input'])+' ('+str(data['status']))
btn = inputs[data['input']]['btn']
bcfg = inputs[data['input']]['cfg']
if data['status']:
btn.config(bg=bcfg['color.enabled'])
else:
btn.config(bg=bcfg['color'])
elif event == 'STATUSCHANGE':
if 'status' in feedbacks.keys():
for b in feedbacks['status']:
......
......@@ -29,7 +29,7 @@ STATUSES=[
class TaskEngine():
status='manual'
scene='open'
scene='manual'
def set_manual(self, manual=True):
nst = False
......@@ -57,7 +57,7 @@ class TaskEngine():
# self.set_manual(False)
#else:
# self.set_manual(True)
elif event=='OUTPUTCHANGE':
elif event in ['OUTPUTCHANGE', 'INPUTSTATUSCHANGE']:
qpnl.put(task)
qweb.put(task)
......
......@@ -41,17 +41,20 @@ socketio = SocketIO(flask_app)
buttons, numrows = get_buttons()
outputs = {}
feedbacks = {}
inputs = {}
if numrows > 0:
row = 1
while row <= numrows:
for b in buttons[row].keys():
if 'output' in buttons[row][b].keys():
outputs[buttons[row][b]['output']] = {'cfg': buttons[row][b]}
elif 'input' in buttons[row][b].keys():
inputs[buttons[row][b]['input']] = {'cfg': buttons[row][b]}
elif 'feedback' in buttons[row][b].keys():
if not buttons[row][b]['feedback'] in feedbacks.keys():
feedbacks[buttons[row][b]['feedback']] = [{'cfg': buttons[row][b]}]
else:
feedbacks[buttons[row][b]['feedback']].append({'btn': button, 'cfg': buttons[row][b]})
feedbacks[buttons[row][b]['feedback']].append({'cfg': buttons[row][b]})
row = row+1
......@@ -113,6 +116,8 @@ def index():
pollclass=''
if 'output' in buttons[row][b].keys():
pollclass='output_'+buttons[row][b]['output']
if 'input' in buttons[row][b].keys():
pollclass='input_'+buttons[row][b]['input']
elif 'feedback'in buttons[row][b].keys():
pollclass='feedback_'+buttons[row][b]['feedback']
htmlbuttons=htmlbuttons+"""<button style="color:white;background-color:"""+color+""";"
......@@ -174,6 +179,14 @@ def get_queue():
emit('change_output', {'button': data['output'], 'color': bcfg['color.'+str(data['status'])] }, broadcast=True)
if 'title.'+str(data['status']) in bcfg.keys():
emit('change_output', {'button': data['output'], 'title': bcfg['title.'+str(data['status'])] }, broadcast=True)
if event == 'INPUTSTATUSCHANGE':
if data['input'] in inputs.keys():
logging.info('CHANGE THE COLOR OF THE WEB BUTTON FOR '+str(data['input']))
bcfg = inputs[data['input']]['cfg']
if data['status']:
emit('change_input', {'button': data['input'], 'color': bcfg['color.enabled'] }, broadcast=True)
else:
emit('change_input', {'button': data['input'], 'color': bcfg['color']}, broadcast=True)
elif event == 'STATUSCHANGE':
if 'status' in feedbacks.keys():
for b in feedbacks['status']:
......
......@@ -308,6 +308,11 @@ along with this program. If not, see <https://www.gnu.org/licenses/>.
$('.output_'+msg.button).css('background-color', msg.color);
});
socket.on('change_input', function(msg, cb) {
$('.input_'+msg.button).css('background-color', msg.color);
});
socket.on('change_feedback', function(msg, cb) {
if(msg.hasOwnProperty("color"))
$('.feedback_'+msg.feedback).css('background-color', msg.color);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment