Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- string(6386) "# Welcome to the AzuraCast Liquidsoap configuration editor.
- # Using this page, you can customize several sections of the Liquidsoap configuration.
- # The non-editable sections are automatically generated by AzuraCast.
- custom_config_top
- set("init.daemon", false)
- set("init.daemon.pidfile.path","/var/azuracast/stations/stream_soft/config/liquidsoap.pid")
- set("log.stdout", true)
- set("log.file", false)
- set("server.telnet",true)
- set("server.telnet.bind_addr","0.0.0.0")
- set("server.telnet.port", 8004)
- set("harbor.bind_addrs",["0.0.0.0"])
- set("tag.encodings",["UTF-8","ISO-8859-1"])
- set("encoder.encoder.export",["artist","title","album","song"])
- setenv("TZ", "UTC")
- azuracast_api_auth = ref "xxxxxx"
- ignore(azuracast_api_auth)
- custom_config_pre_playlists
- playlist_all = playlist(id="playlist_all",mode="randomize",reload_mode="watch",conservative=true,default_duration=10.,length=20.,"/var/azuracast/stations/stream_soft/playlists/playlist_all.m3u")
- playlist_all = audio_to_stereo(id="stereo_playlist_all", playlist_all)
- playlist_all = cue_cut(id="cue_playlist_all", playlist_all)
- # Standard Playlists
- radio = random(id="stream_soft_standard_playlists", weights=[3], [playlist_all])
- # AutoDJ Next Song Script
- def azuracast_next_song() =
- 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="")
- log("AzuraCast Raw Response: #{uri}")
- if uri == "" or string.match(pattern="Error", uri) then
- []
- else
- r = request.create(uri)
- if request.resolve(r) then
- [r]
- else
- []
- end
- end
- end
- dynamic = request.dynamic.list(id="stream_soft_next_song", timeout=20., retry_delay=3., azuracast_next_song)
- dynamic = audio_to_stereo(id="stream_soft_stereo_next_song", dynamic)
- dynamic = cue_cut(id="stream_soft_cue_next_song", dynamic)
- radio = fallback(id="stream_soft_autodj_fallback", track_sensitive = true, [dynamic, radio])
- requests = request.queue(id="stream_soft_requests")
- requests = audio_to_stereo(id="stream_soft_stereo_requests", requests)
- requests = cue_cut(id="stream_soft_cue_requests", requests)
- radio = fallback(id="stream_soft_requests_fallback", track_sensitive = true, [requests, radio])
- add_skip_command(radio)
- custom_config_pre_fade
- radio = crossfade(smart=false, duration=3.00,fade_out=2.00,fade_in=2.00,radio)
- custom_config_pre_live
- # DJ Authentication
- live_enabled = ref false
- last_authenticated_dj = ref ""
- live_dj = ref ""
- def dj_auth(auth_user,auth_pw) =
- user = ref ""
- password = ref ""
- if (auth_user == "source" or auth_user == "") and (string.match(pattern="(:|,)+", auth_pw)) then
- auth_string = string.split(separator="(:|,)", auth_pw)
- user := list.nth(default="", auth_string, 0)
- password := list.nth(default="", auth_string, 2)
- else
- user := auth_user
- password := auth_pw
- end
- log("Authenticating DJ: #{!user}")
- 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="")
- log("AzuraCast DJ Auth Response: #{ret}")
- authed = bool_of_string(ret)
- if (authed) then
- last_authenticated_dj := !user
- end
- authed
- end
- def live_connected(header) =
- dj = !last_authenticated_dj
- log("DJ Source connected! Last authenticated DJ: #{dj} - #{header}")
- live_enabled := true
- live_dj := dj
- 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="")
- log("AzuraCast Live Connected Response: #{ret}")
- end
- def live_disconnected() =
- dj = !live_dj
- log("DJ Source disconnected! Current live DJ: #{dj}")
- 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="")
- log("AzuraCast Live Disconnected Response: #{ret}")
- live_enabled := false
- last_authenticated_dj := ""
- live_dj := ""
- end
- # A Pre-DJ source of radio that can be broadcast if needed
- radio_without_live = radio
- ignore(radio_without_live)
- # Live Broadcasting
- live = audio_to_stereo(input.harbor("/", id = "stream_soft_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 = 5.00, max = 10.00))
- ignore(output.dummy(live, fallible=true))
- radio = fallback(id="stream_soft_live_fallback", replay_metadata=false, track_sensitive=false, [live, radio])
- # Allow for Telnet-driven insertion of custom metadata.
- radio = server.insert_metadata(id="custom_metadata", radio)
- # Apply amplification metadata (if supplied)
- radio = amplify(override="liq_amplify", 1., radio)
- radio = fallback(id="stream_soft_safe_fallback", track_sensitive = false, [radio, single(id="error_jingle", "/usr/local/share/icecast/web/error.mp3")])
- custom_config
- # Send metadata changes back to AzuraCast
- def metadata_updated(m) =
- def f() =
- if (m["song_id"] != "") then
- 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="")
- log("AzuraCast Feedback Response: #{ret}")
- end
- (-1.)
- end
- add_timeout(fast=false, 0., f)
- end
- radio = on_metadata(metadata_updated,radio)
- # Local Broadcasts
- output.icecast(%mp3(samplerate=44100, stereo=true, bitrate=128, id3v2=true), id="stream_soft_local_1", host = "127.xxx", port = xxxx, password = "xxxxx", mount = "/radio.mp3", name = "Stream Soft", description = "", genre = "", public = false, encoding = "UTF-8", radio)
- # Remote Relays"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement