Skip to content
Snippets Groups Projects
Commit 1b89eab0 authored by David Trattnig's avatar David Trattnig
Browse files

Station fallback. #43

parent 522356bd
No related branches found
No related tags found
No related merge requests found
......@@ -23,46 +23,104 @@
icecast_vorbis_metadata = false
inputs = ref []
# load settings from ini file
# Load settings from ini file
%include "settings.liq"
# include some functions
%include "library.liq"
print("**************************************************************************************")
print(" ENGINE LIQUIDSOAP CONFIGURATION ")
print("**************************************************************************************")
print(" Engine Configuration Folder: #{engine_config_folder}")
print(" Station Fallback Playlist: #{fallback_station_playlist_path}")
print(" Station Fallback Directory: #{fallback_station_dir}")
print("**************************************************************************************")
# include fallback functions
%include "fallback.liq"
# Include some functions
%include "library.liq"
#################
# create inputs #
#################
######################
# INPUTS #
######################
# enable play from filesystem
# Enable play from filesystem
%include "in_filesystem.liq"
# enable stream overtakes
# Enable stream overtakes
%include "in_stream.liq"
# enabled line in from soundcard
# Enabled line in from soundcard
%include "in_soundcard.liq"
# fill the mixer
mixer = mix(id="mixer", list.append([input_filesystem_0, input_filesystem_1, input_http_0, input_http_1, input_https_0, input_https_1], !inputs))
# output source with fallbacks
stripped_stream = strip_blank(id='strip_blank', track_sensitive=false, max_blank=fallback_max_blank, min_noise=fallback_min_noise, threshold=fallback_threshold, mixer)
# enable fallback
# output_source = fallback(id="fallback", track_sensitive=false, [stripped_stream, timeslot_fallback, show_fallback, mksafe(station_fallback)])
#output_source = fallback(id="fallback", track_sensitive=false, [stripped_stream, timeslot_fallback, show_fallback, mksafe(station_fallback)])
output_source = mksafe(stripped_stream)
ignore(timeslot_fallback)
ignore(show_fallback)
ignore(station_fallback)
##################
# create outputs #
##################
######################
# ROUTING #
######################
mixer = mix(id="mixer",
list.append(
[
input_filesystem_0,
input_filesystem_1,
input_http_0,
input_http_1,
input_https_0,
input_https_1
],
!inputs
)
)
stripped_stream = strip_blank(
id='strip_blank',
track_sensitive=false,
max_blank=fallback_max_blank,
min_noise=fallback_min_noise,
threshold=fallback_threshold,
mixer
)
station_playlist = playlist(
id="station_playlist",
fallback_station_playlist_path,
mode="randomize",
reload_mode="watch",
reload=10)
station_folder = mksafe(
playlist(id="station_folder",
fallback_station_dir,
mode="randomize",
reload=fallback_station_dir_reload,
reload_mode="seconds"))
# When some regular playout is happening and it is returned to the fallback,
# we don't want to resume the previous fallback track:
def on_track_change(s) =
source.skip(station_playlist)
source.skip(station_folder)
end
stripped_stream = on_track(on_track_change, stripped_stream)
station_playlist = augment_fallback(station_playlist)
station_folder = augment_fallback( station_folder)
output_source = fallback(
id="fallback-station-playlist",
track_sensitive=false,
replay_metadata=true,
[ stripped_stream, station_playlist])
output_source = fallback(
id="fallback-station-folder",
track_sensitive=false,
replay_metadata=true,
[ output_source, station_folder])
######################
# OUTPUTS #
######################
# create soundcard output
%include "out_soundcard.liq"
......
......@@ -19,10 +19,6 @@
input_filesystem_0 = request.equeue(id="in_filesystem_0")
input_filesystem_1 = request.equeue(id="in_filesystem_1")
# input_filesystem_2 = request.equeue(id="in_filesystem_2")
# input_filesystem_3 = request.equeue(id="in_filesystem_3")
# input_filesystem_4 = request.equeue(id="in_filesystem_4")
#input_fs = cue_cut(mksafe(request.equeue(id="fs")))
......@@ -40,30 +36,6 @@ input_filesystem_0 = on_metadata(id="in_filesystem_0", do_meta_filesystem, input
input_filesystem_1 = on_metadata(id="in_filesystem_1", do_meta_filesystem, input_filesystem_1)
# def clear_queue(s) =
# ret = server.execute("fs.queue")
# #ret = request.equeue(id="fs")
# ret = list.hd(default="",ret)
# ret = string.split(separator=" ",ret)
# #print("input FS.list: #{ret}")
# list.iter(fun(x) -> begin
# print("IGNORE: #{x}")
# ignore(server.execute("fs.ignore #{x}"))
# end, ret)
# res = source.skip(s)
# #(0.5)
# print("SKIP RES: #{res}")
# res = source.skip(s)
# print("SKIP RES: #{res}")
# end
# server.register(namespace="fs",
# description="Flush queue and stop request source.",
# usage="stop",
# "stop",
# fun (s) -> begin clear_queue(input_fs) "Done." end)
def clear_items(ns) =
ret = server.execute("#{source.id(ns)}.primary_queue")
ret = list.hd(default="", ret)
......@@ -86,12 +58,23 @@ server.register(namespace=source.id(input_filesystem_0),
description="Clear all items of the filesystem Queue A.",
usage="clear",
"clear_filesystem_0",
fun (s) -> begin clear_queue(input_filesystem_0) "Done." end)
fun (s) ->
begin
clear_queue(input_filesystem_0)
"Clearing done."
end
)
# Clear Queue 1
server.register(namespace=source.id(input_filesystem_1),
description="Clear all items of the filesystem Queue B.",
usage="clear",
"clear_filesystem_1",
fun (s) -> begin clear_queue(input_filesystem_1) "Done." end)
fun (s) ->
begin
clear_queue(input_filesystem_1)
"Clearing done."
end
)
......@@ -17,6 +17,28 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#####################
# basics #
#####################
# Called when some new metadata info is available
def on_metadata_notification(meta) =
filename = meta["filename"]
# artist = meta["artist"]
# title = meta["title"]
system('#{list.assoc(default="", "install_dir", ini)}/guru.py --on_play "#{filename}"')
end
def augment_fallback(source) =
# Apply normalization using ReplayGain information
source = amplify(1., override="replay_gain", source)
# Watch metadata change
source = on_metadata(on_metadata_notification, source)
source
end
#####################
# stream to icecast #
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment