Advertisement
ivellios1988

Untitled

Aug 11th, 2021
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.69 KB | None | 0 0
  1. # WARNING! This file is automatically generated by AzuraCast.
  2. # Do not update it directly!
  3.  
  4.  
  5. set("init.daemon", false)
  6. set("init.daemon.pidfile.path","/var/azuracast/stations/radio_paranormalium/config/liquidsoap.pid")
  7. set("log.stdout", true)
  8. set("log.file", false)
  9. set("server.telnet",true)
  10. set("server.telnet.bind_addr","0.0.0.0")
  11. set("server.telnet.port", 8004)
  12. set("harbor.bind_addrs",["0.0.0.0"])
  13.  
  14. set("tag.encodings",["UTF-8","ISO-8859-1"])
  15. set("encoder.encoder.export",["artist","title","album","song"])
  16.  
  17. setenv("TZ", "Europe/Warsaw")
  18.  
  19. azuracast_api_auth = ref "(PASSWORD)"
  20. ignore(azuracast_api_auth)
  21.  
  22. autodj_is_loading = ref true
  23. ignore(autodj_is_loading)
  24.  
  25. autodj_ping_attempts = ref 0
  26. ignore(autodj_ping_attempts)
  27.  
  28. playlist_muzyka_dzien = playlist(id="playlist_muzyka_dzien",mode="randomize",reload_mode="watch",conservative=true,default_duration=10.,length=20.,"/var/azuracast/stations/radio_paranormalium/playlists/playlist_muzyka_dzien.m3u")
  29. playlist_muzyka_dzien = audio_to_stereo(id="stereo_playlist_muzyka_dzien", playlist_muzyka_dzien)
  30. playlist_muzyka_dzien = cue_cut(id="cue_playlist_muzyka_dzien", playlist_muzyka_dzien)
  31.  
  32. playlist_muzyka_noc = playlist(id="playlist_muzyka_noc",mode="randomize",reload_mode="watch",conservative=true,default_duration=10.,length=20.,"/var/azuracast/stations/radio_paranormalium/playlists/playlist_muzyka_noc.m3u")
  33. playlist_muzyka_noc = audio_to_stereo(id="stereo_playlist_muzyka_noc", playlist_muzyka_noc)
  34. playlist_muzyka_noc = cue_cut(id="cue_playlist_muzyka_noc", playlist_muzyka_noc)
  35.  
  36. playlist_audycje_wszystkie = playlist(id="playlist_audycje_wszystkie",mode="randomize",reload_mode="watch",conservative=true,default_duration=10.,length=20.,"/var/azuracast/stations/radio_paranormalium/playlists/playlist_audycje_wszystkie.m3u")
  37. playlist_audycje_wszystkie = audio_to_stereo(id="stereo_playlist_audycje_wszystkie", playlist_audycje_wszystkie)
  38. playlist_audycje_wszystkie = cue_cut(id="cue_playlist_audycje_wszystkie", playlist_audycje_wszystkie)
  39.  
  40. playlist_jingle = playlist(id="playlist_jingle",mode="randomize",reload_mode="watch",conservative=true,default_duration=10.,length=20.,"/var/azuracast/stations/radio_paranormalium/playlists/playlist_jingle.m3u")
  41. playlist_jingle = audio_to_stereo(id="stereo_playlist_jingle", playlist_jingle)
  42. playlist_jingle = cue_cut(id="cue_playlist_jingle", playlist_jingle)
  43.  
  44. playlist_audycje_najnowsze = playlist(id="playlist_audycje_najnowsze",mode="randomize",reload_mode="watch",conservative=true,default_duration=10.,length=20.,"/var/azuracast/stations/radio_paranormalium/playlists/playlist_audycje_najnowsze.m3u")
  45. playlist_audycje_najnowsze = audio_to_stereo(id="stereo_playlist_audycje_najnowsze", playlist_audycje_najnowsze)
  46. playlist_audycje_najnowsze = cue_cut(id="cue_playlist_audycje_najnowsze", playlist_audycje_najnowsze)
  47.  
  48. # Standard Playlists
  49. radio = random(id="standard_playlists", weights=[], [])
  50.  
  51. # Standard Schedule Switches
  52.  
  53. radio = switch(id="schedule_switch", track_sensitive=true, [ ({ 7h0m-22h0m }, playlist_muzyka_dzien), ({ (22h0m-23h59m59s) or (00h00m-7h0m) }, playlist_muzyka_noc), ({true}, radio) ])
  54.  
  55. # Once per x Songs Playlists
  56. radio = rotate(weights=[1,5], [playlist_audycje_wszystkie, radio])
  57. radio = rotate(weights=[1,3], [playlist_jingle, radio])
  58. radio = rotate(weights=[1,7], [playlist_audycje_najnowsze, radio])
  59.  
  60. # AutoDJ Next Song Script
  61. def autodj_next_song() =
  62. uri = list.hd(get_process_lines(env=[("API_AUTH", !azuracast_api_auth)], 'curl -s --request POST --url http://web/api/internal/1/nextsong --form api_auth="$API_AUTH"'), default="")
  63. log("AzuraCast Raw Response: #{uri}")
  64.  
  65. if uri == "" or string.match(pattern="Error", uri) then
  66. []
  67. else
  68. r = request.create(uri)
  69. if request.resolve(r) then
  70. [r]
  71. else
  72. []
  73. end
  74. end
  75. end
  76.  
  77. # Delayed ping for AutoDJ Next Song
  78. def wait_for_next_song(autodj)
  79. autodj_ping_attempts := !autodj_ping_attempts + 1
  80. delay = ref 0.5
  81.  
  82. if source.is_ready(!autodj) then
  83. log("AutoDJ is ready!")
  84.  
  85. autodj_is_loading := false
  86. delay := -1.0
  87. elsif !autodj_ping_attempts > 200 then
  88. log("AutoDJ could not be initialized within the specified timeout.")
  89.  
  90. autodj_is_loading := false
  91. delay := -1.0
  92. end
  93.  
  94. !delay
  95. end
  96.  
  97. dynamic = request.dynamic.list(id="next_song", timeout=20., retry_delay=2., autodj_next_song)
  98. dynamic = audio_to_stereo(id="stereo_next_song", dynamic)
  99. dynamic = cue_cut(id="cue_next_song", dynamic)
  100.  
  101. dynamic_startup = fallback(
  102. id = "dynamic_startup",
  103. track_sensitive = false,
  104. [
  105. dynamic,
  106. at(
  107. fun()-> !autodj_is_loading,
  108. blank(id = "autodj_startup_blank", duration = 120.)
  109. )
  110. ]
  111. )
  112. radio = fallback(id="autodj_fallback", track_sensitive = true, [dynamic_startup, radio])
  113.  
  114. ref_dynamic = ref dynamic;
  115. add_timeout(0.25,fun()->wait_for_next_song(ref_dynamic))
  116.  
  117. requests = request.queue(id="requests")
  118. requests = audio_to_stereo(id="stereo_requests", requests)
  119. requests = cue_cut(id="cue_requests", requests)
  120.  
  121. radio = fallback(id="requests_fallback", track_sensitive = true, [requests, radio])
  122. add_skip_command(radio)
  123.  
  124. radio = crossfade(smart=false, duration=3.00,fade_out=2.00,fade_in=2.00,radio)
  125.  
  126. # DJ Authentication
  127. live_enabled = ref false
  128. last_authenticated_dj = ref ""
  129. live_dj = ref ""
  130.  
  131. def dj_auth(auth_user,auth_pw) =
  132. user = ref ""
  133. password = ref ""
  134.  
  135. if (auth_user == "source" or auth_user == "") and (string.match(pattern="(:|,)+", auth_pw)) then
  136. auth_string = string.split(separator="(:|,)", auth_pw)
  137.  
  138. user := list.nth(default="", auth_string, 0)
  139. password := list.nth(default="", auth_string, 2)
  140. else
  141. user := auth_user
  142. password := auth_pw
  143. end
  144.  
  145. log("Authenticating DJ: #{!user}")
  146.  
  147. ret = list.hd(get_process_lines(env=[("DJ_USER", !user), ("DJ_PASSWORD", !password), ("API_AUTH", !azuracast_api_auth)], 'curl -s --request POST --url http://web/api/internal/1/auth --form dj-user="$DJ_USER" --form dj-password="$DJ_PASSWORD" --form api_auth="$API_AUTH"'), default="")
  148. log("AzuraCast DJ Auth Response: #{ret}")
  149.  
  150. authed = bool_of_string(ret)
  151. if (authed) then
  152. last_authenticated_dj := !user
  153. end
  154.  
  155. authed
  156. end
  157.  
  158. def live_connected(header) =
  159. dj = !last_authenticated_dj
  160. log("DJ Source connected! Last authenticated DJ: #{dj} - #{header}")
  161.  
  162. live_enabled := true
  163. live_dj := dj
  164.  
  165. ret = list.hd(get_process_lines(env=[("DJ_USER", dj), ("API_AUTH", !azuracast_api_auth)], 'curl -s --request POST --url http://web/api/internal/1/djon --form dj-user="$DJ_USER" --form api_auth="$API_AUTH"'), default="")
  166. log("AzuraCast Live Connected Response: #{ret}")
  167. end
  168.  
  169. def live_disconnected() =
  170. dj = !live_dj
  171.  
  172. log("DJ Source disconnected! Current live DJ: #{dj}")
  173.  
  174. ret = list.hd(get_process_lines(env=[("DJ_USER", dj), ("API_AUTH", !azuracast_api_auth)], 'curl -s --request POST --url http://web/api/internal/1/djoff --form dj-user="$DJ_USER" --form api_auth="$API_AUTH"'), default="")
  175. log("AzuraCast Live Disconnected Response: #{ret}")
  176.  
  177. live_enabled := false
  178. last_authenticated_dj := ""
  179. live_dj := ""
  180. end
  181.  
  182. # A Pre-DJ source of radio that can be broadcast if needed',
  183. radio_without_live = radio
  184. ignore(radio_without_live)
  185.  
  186. # Live Broadcasting
  187. live = audio_to_stereo(input.harbor("/", id = "input_streamer", port = 8005, auth = dj_auth, icy = true, icy_metadata_charset = "UTF-8", metadata_charset = "UTF-8", on_connect = live_connected, on_disconnect = live_disconnected, buffer = 15.00, max = 20.00))
  188. ignore(output.dummy(live, fallible=true))
  189.  
  190. radio = fallback(id="live_fallback", replay_metadata=false, track_sensitive=false, [live, radio])
  191.  
  192. # Allow for Telnet-driven insertion of custom metadata.
  193. radio = server.insert_metadata(id="custom_metadata", radio)
  194.  
  195. # Apply amplification metadata (if supplied)
  196. radio = amplify(override="liq_amplify", 1., radio)
  197.  
  198. radio = fallback(id="safe_fallback", track_sensitive = false, [radio, single(id="error_jingle", "/usr/local/share/icecast/web/error.mp3")])
  199.  
  200. # Send metadata changes back to AzuraCast
  201. def metadata_updated(m) =
  202. def f() =
  203. if (m["song_id"] != "") then
  204. ret = list.hd(get_process_lines(env=[("SONG", m["song_id"]), ("MEDIA", m["media_id"]), ("PLAYLIST", m["playlist_id"]), ("API_AUTH", !azuracast_api_auth)], 'curl -s --request POST --url http://web/api/internal/1/feedback --form song="$SONG" --form media="$MEDIA" --form playlist="$PLAYLIST" --form api_auth="$API_AUTH"'), default="")
  205. log("AzuraCast Feedback Response: #{ret}")
  206. end
  207. (-1.)
  208. end
  209.  
  210. add_timeout(fast=false, 0., f)
  211. end
  212.  
  213. radio = on_metadata(metadata_updated,radio)
  214.  
  215. radioMONO = mean(radio)
  216. radioOPUS = drop_metadata(radio)
  217. radioOPUSmono = mean(radioOPUS)
  218. radioMONOaac = audio_to_stereo(radioMONO)
  219.  
  220. def remove_unknown(radio)
  221. # Remove (_,"Unknown") metadata
  222. def f(m) =
  223. def unknown_meta(el) =
  224. let (_, m) = el
  225. m != "Unknown"
  226. end
  227.  
  228. list.filter(unknown_meta, m)
  229. end
  230.  
  231. map_metadata(update=false, f, radio)
  232. end
  233.  
  234. radio = remove_unknown(radio)
  235.  
  236. # Local Broadcasts
  237. output.icecast(%mp3(samplerate=44100, stereo=true, bitrate=128, id3v2=true), id="local_1", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/1", name = "Radio Paranormalium", description = "", genre = "", public = false, encoding = "UTF-8", radio)
  238. output.icecast(%fdkaac(channels=2, samplerate=44100, bitrate=320, afterburner=true, aot="mpeg4_aac_lc", sbr_mode=false), id="local_2", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/2", name = "Radio Paranormalium", description = "", genre = "", public = true, encoding = "UTF-8", radio)
  239. output.icecast(%opus(samplerate=48000, bitrate=192, vbr="none", application="audio", channels=2, signal="music", complexity=10, max_bandwidth="full_band"), id="local_3", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/opusHQ", name = "Radio Paranormalium", description = "", genre = "", public = true, encoding = "UTF-8", icy_metadata="true", radioOPUS)
  240. output.icecast(%mp3(samplerate=22050, stereo=false, bitrate=48, id3v2=true), id="local_4", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/mp3_48", name = "Radio Paranormalium", description = "", genre = "", public = true, encoding = "UTF-8", radioMONO)
  241. output.icecast(%fdkaac(channels=2, samplerate=44100, bitrate=24, afterburner=false, aot="mpeg4_he_aac_v2", sbr_mode=true), id="local_5", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/5", name = "Radio Paranormalium", description = "", genre = "", public = true, encoding = "UTF-8", radioMONOaac)
  242. output.icecast(%opus(samplerate=48000, bitrate=24, vbr="none", application="audio", channels=1, signal="music", complexity=10, max_bandwidth="full_band"), id="local_6", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/opus24", name = "Radio Paranormalium", description = "", genre = "", public = true, encoding = "UTF-8", icy_metadata="true", radioOPUSmono)
  243. output.icecast(%mp3(samplerate=22050, stereo=false, bitrate=24, id3v2=true), id="local_7", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/6", name = "Radio Paranormalium", description = "", genre = "", public = true, encoding = "UTF-8", radioMONO)
  244. output.icecast(%opus(samplerate=48000, bitrate=8, vbr="none", application="audio", channels=1, signal="music", complexity=10, max_bandwidth="full_band"), id="local_8", host = "127.0.0.1", port = 8000, password = "(PASSWORD)", mount = "/opus8", name = "Radio Paranormalium", description = "", genre = "", public = true, encoding = "UTF-8", icy_metadata="true", radioOPUSmono)
  245.  
  246. # Remote Relays
  247.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement