CC-3367: Display in Now Playing whether Live DJ stream and Live Master stream
are connected and give user the ability to block those streams - added stream source switch interface - backend code
This commit is contained in:
parent
d4a387e113
commit
f193047a1c
19 changed files with 383 additions and 38 deletions
|
@ -92,6 +92,9 @@ class PypoFetch(Thread):
|
|||
elif command == 'cancel_current_show':
|
||||
self.logger.info("Cancel current show command received...")
|
||||
self.stop_current_show()
|
||||
elif command == 'switch_source':
|
||||
self.logger.info("switch_on_source show command received...")
|
||||
self.switch_source(m['sourcename'], m['status'])
|
||||
except Exception, e:
|
||||
import traceback
|
||||
top = traceback.format_exc()
|
||||
|
@ -99,6 +102,27 @@ class PypoFetch(Thread):
|
|||
self.logger.error("traceback: %s", top)
|
||||
self.logger.error("Exception in handling Message Handler message: %s", e)
|
||||
|
||||
def switch_source(self, sourcename, status):
|
||||
self.logger.debug('Switching source: %s to "%s" status', sourcename, status)
|
||||
command = "streams."
|
||||
if(sourcename == "master_dj"):
|
||||
command += "master_dj_"
|
||||
else:
|
||||
command += "live_dj_"
|
||||
|
||||
if(status == "on"):
|
||||
command += "start\n"
|
||||
else:
|
||||
command += "stop\n"
|
||||
|
||||
try:
|
||||
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
|
||||
tn.write(command)
|
||||
tn.write('exit\n')
|
||||
tn.read_all()
|
||||
except Exception, e:
|
||||
self.logger.debug(e)
|
||||
self.logger.debug('Could not connect to liquidsoap')
|
||||
|
||||
def stop_current_show(self):
|
||||
self.logger.debug('Notifying Liquidsoap to stop playback.')
|
||||
|
@ -353,15 +377,22 @@ class PypoFetch(Thread):
|
|||
|
||||
|
||||
def create_liquidsoap_annotation(self, media):
|
||||
entry = \
|
||||
"""entry = \
|
||||
'annotate:media_id="%s",liq_start_next="%s",liq_fade_in="%s",liq_fade_out="%s",liq_cue_in="%s",liq_cue_out="%s",schedule_table_id="%s":%s' \
|
||||
% (media['id'], 0, \
|
||||
float(media['fade_in']) / 1000, \
|
||||
float(media['fade_out']) / 1000, \
|
||||
float(media['cue_in']), \
|
||||
float(media['cue_out']), \
|
||||
media['row_id'], media['dst'])"""
|
||||
|
||||
entry = \
|
||||
'annotate:media_id="%s",liq_start_next="%s",liq_cue_in="%s",liq_cue_out="%s",schedule_table_id="%s":%s' \
|
||||
% (media['id'], 0, \
|
||||
float(media['cue_in']), \
|
||||
float(media['cue_out']), \
|
||||
media['row_id'], media['dst'])
|
||||
|
||||
|
||||
return entry
|
||||
|
||||
def check_for_previous_crash(self, media_item):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue