CC-3483: Live Stream: default fade in/out for live stream transition

- done. changing fade value doesn't require LS to restart
This commit is contained in:
James 2012-03-20 22:16:17 -04:00
parent 4bb0421cf7
commit 6b768c2f99
8 changed files with 68 additions and 5 deletions

View file

@ -15,15 +15,12 @@ def append_title(m) =
end
end
default_dj_fade_in = ref 5.
default_dj_fade_out = ref 5.
def transition(a,b) =
log("transition called...")
add(normalize=false,
[ sequence([ blank(duration=2.),
fade.initial(duration=!default_dj_fade_in, b) ]),
fade.final(duration=!default_dj_fade_out, a) ])
fade.initial(duration=!default_dj_fade, b) ]),
fade.final(duration=!default_dj_fade, a) ])
end
def crossfade(s)

View file

@ -14,6 +14,7 @@ queue = cue_cut(queue)
pypo_data = ref '0'
web_stream_enabled = ref false
stream_metadata_type = ref 0
default_dj_fade = ref 0.
station_name = ref ''
show_name = ref ''
@ -37,6 +38,7 @@ server.register(namespace="vars", "show_name", fun (s) -> begin show_name := s s
server.register(namespace="vars", "station_name", fun (s) -> begin station_name := s s end)
server.register(namespace="vars", "bootup_time", fun (s) -> begin time := s s end)
server.register(namespace="streams", "connection_status", fun (s) -> begin "1:#{!s1_connected},2:#{!s2_connected},3:#{!s3_connected}" end)
server.register(namespace="vars", "default_dj_fade", fun (s) -> begin default_dj_fade := float_of_string(s) s end)
default = amplify(id="silence_src", 0.00001, noise())

View file

@ -82,6 +82,9 @@ class PypoFetch(Thread):
elif command == 'update_station_name':
self.logger.info("Updating station name...")
self.update_liquidsoap_station_name(m['station_name'])
elif command == 'update_transition_fade':
self.logger.info("Updating transition_fade...")
self.update_liquidsoap_transition_fade(m['transition_fade'])
elif command == 'switch_source':
self.logger.info("switch_on_source show command received...")
self.switch_source(m['sourcename'], m['status'])
@ -317,6 +320,22 @@ class PypoFetch(Thread):
finally:
self.telnet_lock.release()
def update_liquidsoap_transition_fade(self, fade):
# Push stream metadata to liquidsoap
# TODO: THIS LIQUIDSOAP STUFF NEEDS TO BE MOVED TO PYPO-PUSH!!!
try:
self.telnet_lock.acquire()
tn = telnetlib.Telnet(LS_HOST, LS_PORT)
command = ('vars.default_dj_fade %s\n' % fade).encode('utf-8')
self.logger.info(command)
tn.write(command)
tn.write('exit\n')
tn.read_all()
except Exception, e:
self.logger.error("Exception %s", e)
finally:
self.telnet_lock.release()
def update_liquidsoap_station_name(self, station_name):
# Push stream metadata to liquidsoap
# TODO: THIS LIQUIDSOAP STUFF NEEDS TO BE MOVED TO PYPO-PUSH!!!

View file

@ -73,6 +73,9 @@ class PypoMessageHandler(Thread):
elif command == 'switch_source':
self.logger.info("switch_source command received...")
self.pypo_queue.put(message)
elif command == 'update_transition_fade':
self.logger.info("Updating trasition fade...")
self.pypo_queue.put(message)
elif command == 'disconnect_source':
self.logger.info("disconnect_source command received...")
self.pypo_queue.put(message)