Merge branch 'master' of dev.sourcefabric.org:campcaster
This commit is contained in:
commit
70f7cb6edc
|
@ -607,7 +607,7 @@ class Schedule {
|
|||
$millisec2 = substr($parts2[1], 0, 3);
|
||||
$millisec2 = str_pad($millisec2, 3, "0");
|
||||
$millisec2 = intval($millisec2);
|
||||
$diff = abs(millisec1 - millisec2)/1000;
|
||||
$diff = abs($millisec1 - $millisec2)/1000;
|
||||
}
|
||||
return $diff;
|
||||
}
|
||||
|
|
|
@ -1,6 +0,0 @@
|
|||
This tool was born out of a collaboration between Open Broadcast
|
||||
and Sourcefabric. The authors of the code are:
|
||||
|
||||
Jonas Ohrstrom <jonas@digris.ch>
|
||||
Paul Baranowski <paul.baranowski@sourcefabric.org>
|
||||
|
|
@ -36,7 +36,7 @@ def create_user(username):
|
|||
os.system("adduser --system --quiet --group --shell /bin/bash "+username)
|
||||
|
||||
#add pypo to audio group
|
||||
os.system("adduser " + username + " audio")
|
||||
os.system("adduser " + username + " pulse-access")
|
||||
|
||||
#set pypo password
|
||||
p = os.popen('/usr/bin/passwd pypo', 'w')
|
||||
|
@ -74,7 +74,6 @@ try:
|
|||
create_path(BASE_PATH+"archive")
|
||||
|
||||
print "Copying pypo files"
|
||||
shutil.copy("../scripts/silence-playlist.lsp", BASE_PATH+"files/basic")
|
||||
shutil.copy("../scripts/silence.mp3", BASE_PATH+"files/basic")
|
||||
|
||||
if platform.architecture()[0] == '64bit':
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -671,16 +671,12 @@ class Playout:
|
|||
i know this could be wrapped, maybe later..
|
||||
"""
|
||||
tn = telnetlib.Telnet(LS_HOST, 1234)
|
||||
|
||||
if (int(ptype) == 6):
|
||||
tn.write("live_in.start")
|
||||
tn.write("\n")
|
||||
|
||||
if (int(ptype) < 5):
|
||||
for line in pl_file.readlines():
|
||||
logger.debug(line.strip())
|
||||
tn.write(self.export_source + '.push %s' % (line.strip()))
|
||||
tn.write("\n")
|
||||
|
||||
for line in pl_file.readlines():
|
||||
line = line.strip()
|
||||
logger.debug(line)
|
||||
tn.write(self.export_source + '.push %s' % (line))
|
||||
tn.write("\n")
|
||||
|
||||
tn.write("exit\n")
|
||||
logger.debug(tn.read_all())
|
||||
|
@ -699,16 +695,6 @@ class Playout:
|
|||
|
||||
tn.write(self.export_source + '.flip')
|
||||
tn.write("\n")
|
||||
|
||||
if (int(ptype) == 6):
|
||||
tn.write("live.active 1")
|
||||
tn.write("\n")
|
||||
else:
|
||||
tn.write("live.active 0")
|
||||
tn.write("\n")
|
||||
tn.write("live_in.stop")
|
||||
tn.write("\n")
|
||||
|
||||
tn.write("exit\n")
|
||||
|
||||
tn.read_all()
|
||||
|
|
|
@ -10,7 +10,7 @@
|
|||
# general settings #
|
||||
###########################################
|
||||
|
||||
log_file = "/var/log/pypo/<script>.log"
|
||||
log_file = "/home/martin/workspace/pypo/<script>.log"
|
||||
log_level = 3
|
||||
|
||||
# archive directory
|
||||
|
|
|
@ -1,106 +1,55 @@
|
|||
######################################
|
||||
# main liquidsoap development script #
|
||||
######################################
|
||||
# author Jonas Ohrstrom <jonas@digris.ch>
|
||||
|
||||
########################################
|
||||
# include configuration #
|
||||
########################################
|
||||
|
||||
%include "library/pervasives.liq"
|
||||
%include "ls_config.liq"
|
||||
%include "library.liq"
|
||||
%include "include_dynamic_vars.liq"
|
||||
%include "include_notify.liq"
|
||||
|
||||
silence_threshold = -50.
|
||||
silence_time = 3.
|
||||
|
||||
# log
|
||||
set("log.file.path",log_file)
|
||||
set("log.stdout", true)
|
||||
set("log.level",log_level)
|
||||
|
||||
# telnet server
|
||||
set("server.telnet", true)
|
||||
|
||||
######################################
|
||||
# some functions needed #
|
||||
######################################
|
||||
def fcross(a,b) =
|
||||
add(normalize=false,[b,a])
|
||||
active_queue = ref 0
|
||||
|
||||
scheduler_q0 = request.queue(conservative=true,length=600.,id="scheduler_q0")
|
||||
scheduler_q1 = request.queue(conservative=true,length=600.,id="scheduler_q1")
|
||||
|
||||
scheduler_q0 = audio_to_stereo(scheduler_q0)
|
||||
scheduler_q1 = audio_to_stereo(scheduler_q1)
|
||||
|
||||
pypo_data = ref '0'
|
||||
|
||||
# push function, enqueues file in inactive queue (does not start automatically)
|
||||
def scheduler_push(s)
|
||||
print('s: #{s}')
|
||||
server.execute("scheduler_q#{!active_queue}.push #{s}")
|
||||
print('push to #{!active_queue} - #{s}')
|
||||
"Done"
|
||||
end
|
||||
|
||||
######################################
|
||||
# live recording functions
|
||||
######################################
|
||||
def live_start() =
|
||||
log("got live source")
|
||||
ignore(execute("archives.start"))
|
||||
# flips the queues
|
||||
def scheduler_flip()
|
||||
# get playing (active) queue and flush it
|
||||
l = list.hd(server.execute("scheduler_q#{!active_queue}.queue"))
|
||||
l = string.split(separator=" ",l)
|
||||
list.iter(fun (rid) -> ignore(server.execute("scheduler_q#{!active_queue}.ignore #{rid}")), l)
|
||||
|
||||
# skip the playing item
|
||||
source.skip(if !active_queue==0 then scheduler_q0 else scheduler_q1 end)
|
||||
|
||||
# flip variables
|
||||
active_queue := 1-!active_queue
|
||||
"Done"
|
||||
end
|
||||
|
||||
def live_stop() =
|
||||
log("live source has gone")
|
||||
ignore(execute("archives.stop"))
|
||||
def notify(m)
|
||||
system("./notify.sh --data='#{!pypo_data}' --media-id=#{m['media_id']}")
|
||||
#print("./notify.sh --data='#{!pypo_data}' --media-id=#{m['media_id']}")
|
||||
end
|
||||
|
||||
# register for telnet access
|
||||
server.register(namespace="scheduler","push", scheduler_push)
|
||||
server.register(namespace="scheduler","flip", fun (s) -> begin scheduler_flip() end)
|
||||
server.register(namespace="vars", "pypo_data", fun (s) -> begin pypo_data := s "Done" end)
|
||||
|
||||
#######################################################################
|
||||
# File locations / sources
|
||||
#######################################################################
|
||||
silence = single("/opt/pypo/files/basic/silence.mp3")
|
||||
jingles_cc = playlist("/opt/pypo/files/jingles/jcc")
|
||||
fallback_airtime = playlist("/opt/pypo/files/basic/silence-playlist.lsp")
|
||||
fallback_airtime = audio_to_stereo(fallback_airtime)
|
||||
default = single("/opt/pypo/files/basic/silence.mp3")
|
||||
radio = fallback([ switch(track_sensitive=false, [(fun () -> !active_queue==1, scheduler_q0), (fun () -> !active_queue==0, scheduler_q1)]), default])
|
||||
|
||||
radio = on_metadata(notify, radio)
|
||||
|
||||
# default
|
||||
default = silence
|
||||
|
||||
special = request.queue(id="special")
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Includeing two A/B Queues, daypart & scheduler
|
||||
# this will give us the sources 'daypart' & 'scheduler'
|
||||
#######################################################################
|
||||
%include "include_daypart.liq"
|
||||
%include "include_scheduler.liq"
|
||||
|
||||
source = fallback(track_sensitive=false,transitions=[dp_to_scheduler],[strip_blank(threshold=silence_threshold,length=silence_time,scheduler),daypart])
|
||||
|
||||
%include "include_live_in.liq"
|
||||
|
||||
live = fallback(track_sensitive=false,[strip_blank(threshold=silence_threshold,length=silence_time,live),fallback_airtime])
|
||||
live = switch(track_sensitive=false, [({!live_active},live)])
|
||||
|
||||
source = fallback(track_sensitive=false,transitions=[to_live_s, to_scheduler_s],[live, source])
|
||||
|
||||
# handle the annotate fades
|
||||
faded = fade.in(type="log", fade.out(type="log", source))
|
||||
|
||||
# add up with a crossfade function (defined above)
|
||||
source = cross(fcross,faded)
|
||||
|
||||
# track start detection (for notifications)
|
||||
source = on_metadata(notify, source)
|
||||
#source = on_track(notify, source)
|
||||
|
||||
# special to mix with final source
|
||||
source = smooth_add(normal=source,special=special)
|
||||
|
||||
|
||||
#####################################
|
||||
# Stream Output
|
||||
#####################################
|
||||
# finally the output | mp3
|
||||
#clock(id="clock_icecast",
|
||||
# output.icecast(%mp3,
|
||||
# host = icecast_host, port = icecast_port,
|
||||
# password = icecast_pass, mount = mount_scheduler,
|
||||
# fallible = true,
|
||||
# restart = true,
|
||||
# restart_delay = 5,
|
||||
# buffer(source)))
|
||||
|
||||
out(source)
|
||||
out(radio)
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
######################################
|
||||
# main liquidsoap development script #
|
||||
######################################
|
||||
# author Jonas Ohrstrom <jonas@digris.ch>
|
||||
|
||||
########################################
|
||||
# include configuration #
|
||||
########################################
|
||||
|
||||
%include "library/pervasives.liq"
|
||||
%include "ls_config.liq"
|
||||
%include "library.liq"
|
||||
%include "include_dynamic_vars.liq"
|
||||
%include "include_notify.liq"
|
||||
|
||||
silence_threshold = -50.
|
||||
silence_time = 3.
|
||||
|
||||
# log
|
||||
set("log.file.path",log_file)
|
||||
set("log.stdout", true)
|
||||
set("log.level",log_level)
|
||||
|
||||
# telnet server
|
||||
set("server.telnet", true)
|
||||
|
||||
######################################
|
||||
# some functions needed #
|
||||
######################################
|
||||
def fcross(a,b) =
|
||||
add(normalize=false,[b,a])
|
||||
end
|
||||
|
||||
######################################
|
||||
# live recording functions
|
||||
######################################
|
||||
def live_start() =
|
||||
log("got live source")
|
||||
ignore(execute("archives.start"))
|
||||
end
|
||||
|
||||
def live_stop() =
|
||||
log("live source has gone")
|
||||
ignore(execute("archives.stop"))
|
||||
end
|
||||
|
||||
|
||||
#######################################################################
|
||||
# File locations / sources
|
||||
#######################################################################
|
||||
silence = single("/opt/pypo/files/basic/silence.mp3")
|
||||
jingles_cc = playlist("/opt/pypo/files/jingles/jcc")
|
||||
fallback_airtime = playlist("/opt/pypo/files/basic/silence-playlist.lsp")
|
||||
fallback_airtime = audio_to_stereo(fallback_airtime)
|
||||
|
||||
|
||||
# default
|
||||
default = silence
|
||||
|
||||
special = request.queue(id="special")
|
||||
|
||||
|
||||
#######################################################################
|
||||
# Includeing two A/B Queues, daypart & scheduler
|
||||
# this will give us the sources 'daypart' & 'scheduler'
|
||||
#######################################################################
|
||||
%include "include_daypart.liq"
|
||||
%include "include_scheduler.liq"
|
||||
|
||||
source = fallback(track_sensitive=false,transitions=[dp_to_scheduler],[strip_blank(threshold=silence_threshold,length=silence_time,scheduler),daypart])
|
||||
|
||||
%include "include_live_in.liq"
|
||||
|
||||
live = fallback(track_sensitive=false,[strip_blank(threshold=silence_threshold,length=silence_time,live),fallback_airtime])
|
||||
live = switch(track_sensitive=false, [({!live_active},live)])
|
||||
|
||||
source = fallback(track_sensitive=false,transitions=[to_live_s, to_scheduler_s],[live, source])
|
||||
|
||||
# handle the annotate fades
|
||||
faded = fade.in(type="log", fade.out(type="log", source))
|
||||
|
||||
# add up with a crossfade function (defined above)
|
||||
source = cross(fcross,faded)
|
||||
|
||||
# track start detection (for notifications)
|
||||
source = on_metadata(notify, source)
|
||||
#source = on_track(notify, source)
|
||||
|
||||
# special to mix with final source
|
||||
source = smooth_add(normal=source,special=special)
|
||||
|
||||
|
||||
#####################################
|
||||
# Stream Output
|
||||
#####################################
|
||||
# finally the output | mp3
|
||||
#clock(id="clock_icecast",
|
||||
# output.icecast(%mp3,
|
||||
# host = icecast_host, port = icecast_port,
|
||||
# password = icecast_pass, mount = mount_scheduler,
|
||||
# fallible = true,
|
||||
# restart = true,
|
||||
# restart_delay = 5,
|
||||
# buffer(source)))
|
||||
|
||||
out(source)
|
Loading…
Reference in New Issue