Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#!/usr/bin/liquidsoap
#
# Aura Engine (https://gitlab.servus.at/aura/engine)
#
# Copyright (C) 2017-2020 - The Aura Engine Team.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU Affero General Public License for more details.
#
# You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
icecast_vorbis_metadata = false
inputs = ref []
# Load settings from ini file
%include "settings.liq"
# Include some functions
%include "library.liq"
#####################################
# EVENTS #
#####################################
# Called when some new metadata info is available
def on_metadata_notification(meta) =
filename = meta["filename"]
track_duration = request.duration(filename)
json_data = json_of(meta)
json_data = '{ "action": "on_metadata", "data": #{json_data}, "track_duration": "#{track_duration}" }'
# There's currently an issue with Liquidsoap http.post requests:
# headers = [("Content-Type","application/json; charset=utf-8")]
# ignore(http.post(headers=headers, data="#{json_data}", "http://#{engine_control}"))
ignore(system("curl -X POST -H 'Content-Type: application/json' --data '#{json_data}' #{engine_control}"))
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
end
#####################################
# INPUTS #
#####################################
# Enable queue sources
%include "in_queue.liq"
# Enable fallback sources
%include "in_fallback.liq"
# Enable stream overtakes
%include "in_stream.liq"
# Enabled line in from soundcard
%include "in_soundcard.liq"
#####################################
# ROUTING #
#####################################
# 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
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
)
stripped_stream = on_track(on_track_change, stripped_stream)
fallback_one = fallback(
id="fallback-scheduled",
track_sensitive=false,
replay_metadata=true,
[ stripped_stream, stripped_fallback_mixer])
fallback_one = on_track(on_track_change, fallback_one)
fallback_two = fallback(
id="fallback-station-playlist",
track_sensitive=false,
replay_metadata=true,
[ fallback_one, station_playlist])
fallback_three = fallback(
id="fallback-station-folder",
track_sensitive=false,
replay_metadata=true,
[ fallback_two, station_folder])
output_source = fallback_three
#####################################
# OUTPUTS #
#####################################
# create soundcard output
%include "out_soundcard.liq"
# stream output
%include "out_stream.liq"
# enable socket functions
%include "serverfunctions.liq"