diff --git a/docker-compose.yml b/docker-compose.yml index a1fc228..35f4098 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -5,10 +5,11 @@ services: build: ./docker-liquidsoap volumes: - ./state/liquidsoap/config:/config - - ./state/liquidsoap/playlists:/playlists + - ./state/playlists:/playlists - ./state/liquidsoap/data:/data + - ./state/jingles:/jingles - /etc/localtime:/etc/localtime:ro - command: /bin/bash -xc 'env; liquidsoap -v --debug /config/debug.liq' + command: /bin/bash -xc 'env; liquidsoap -v --debug /config/main.liq' environment: - HARBOR_PASSWORD=MGT7aEqP - LIVE_PASSWORD=fuckyoujoa @@ -64,7 +65,7 @@ services: links: - main volumes: - - ./state/liquidsoap/playlists:/playlists + - ./state/playlists:/playlists labels: - traefik.enable=true - traefik.frontend.rule=Host:radio.dodsorf.as diff --git a/state/jingles/joa01.wav b/state/jingles/joa01.wav new file mode 100644 index 0000000..3532031 Binary files /dev/null and b/state/jingles/joa01.wav differ diff --git a/state/liquidsoap/config/.main.liq.swp b/state/liquidsoap/config/.main.liq.swp new file mode 100644 index 0000000..3bb7ecf Binary files /dev/null and b/state/liquidsoap/config/.main.liq.swp differ diff --git a/state/liquidsoap/config/debug.liq b/state/liquidsoap/config/debug.liq deleted file mode 100644 index 5d3ccf5..0000000 --- a/state/liquidsoap/config/debug.liq +++ /dev/null @@ -1,62 +0,0 @@ -set("log.file",false) -set("log.stdout",true) - -set("server.telnet",true) -set("server.telnet.port", 5000) -set("server.telnet.bind_addr", "0.0.0.0") - -set("decoder.file_extensions.gstreamer",["wav", "webm"]) -set("decoder.mime_types.gstreamer",["audio/x-wav", "audio/wav", "video/webm"]) - -def crossfade(a,b) - add(normalize=false, - [ sequence([ blank(duration=5.), - fade.initial(duration=5.,b) ]), - fade.final(duration=5.,a) ]) -end - -live = audio_to_stereo( - rewrite_metadata( - [ - ("title", "$(title) (LIVE - Dodsorfas Radio)"), - ("comment", "http://www.radio.dodsorf.as") - ], - stretch( - ratio=interactive.float("test", 1.00005), - input.harbor( - "dodsorfas.live", - id="dodsorfas.live", - port=5002, - password=getenv("LIVE_PASSWORD"), - user="source", - logfile="/tmp/harbor.log" - ) - ) - ) -) - -normal_songs = playlist(reload=600, mime_type="application/x-mpegURL", "http://web/playlist.php") -halloween = playlist("/playlists/events/Halloween.m3u") - -requests = audio_to_stereo(drop_video(request.queue(id="request"))) - -default = switch([ -({true}, normal_songs) -]) - -mix = blank() -mix = fallback(track_sensitive=false, [default, mix]) -mix = fallback(track_sensitive=true, [requests,mix]) -mix = fallback(track_sensitive=false, transitions=[crossfade], [live, mix]) -mix = normalize(mix) -mix = audio_to_stereo(mix) - -# OUTPUTS -output.icecast( - password=getenv("HARBOR_PASSWORD"), - host=getenv("BROADCAST_PORT_5001_TCP_ADDR"), - port=int_of_string(getenv("BROADCAST_PORT_5001_TCP_PORT")), - %wav, - mount="dodsorfas.main", - mix - ) diff --git a/state/liquidsoap/config/main.liq b/state/liquidsoap/config/main.liq index 769feac..fe53c35 100644 --- a/state/liquidsoap/config/main.liq +++ b/state/liquidsoap/config/main.liq @@ -8,50 +8,6 @@ set("server.telnet.bind_addr", "0.0.0.0") set("decoder.file_extensions.gstreamer",["wav", "webm"]) set("decoder.mime_types.gstreamer",["audio/x-wav", "audio/wav", "video/webm"]) -register(name="Youtube_dl-x protocol settings","protocol.youtube-dl-x",()) -register(name="Youtube-dl path","protocol.youtube-dl-x.path","youtube-dl -x --audio-format wav --postprocessor-args \"-y\"") - -# Register the youtube-dl protocol, using youtube-dl. -# Syntax: youtube-d-xl: -# @flag hidden -def youtube_dl_x_protocol(~rlog,~maxtime,arg) - binary = get(default="youtube-dl","protocol.youtube-dl-x.path") - - log = log(label="protocol.youtube-dl-x") - - def log(~level,s) = - rlog(s) - log(level=level,s) - end - - delay = maxtime - gettimeofday() - cmd = "#{binary} -x --audio-format wav --get-title --get-filename -- #{quote(arg)}" - log(level=4,"Executing #{cmd}") - x = get_process_lines(timeout=delay,cmd) - - x = - if list.length(x) >= 2 then - x - else - ["",".osb"] - end - - - ext = "wav" - title = list.hd(default="",x) - cmd = "rm -f $(output) && #{binary} -x --audio-format wav -q -f bestaudio/best --no-playlist --exec \"mv {} $(output)\" -- #{quote(arg)}" - process = process_uri(extname=ext,cmd) - - if title != "" then - ["annotate:title=#{quote(title)}:#{process}"] - else - [process] - end -end -add_protocol("youtube-dl-x", youtube_dl_x_protocol, - doc="Resolve a request using youtube-dl.", -syntax="youtube-dl-x:uri") - def crossfade(a,b) add(normalize=false, [ sequence([ blank(duration=5.), @@ -79,108 +35,33 @@ live = audio_to_stereo( ) ) -## BEGIN PLAYLISTS +normal_songs = playlist(reload=600, mime_type="application/x-mpegURL", "http://web/playlist.php") +halloween = playlist("/playlists/events/Halloween.m3u") -# Joakim -JoakimDiverse = "/playlists/Joakim/JoakimDiverse.m3u" -AlternativeJoa = "/playlists/Joakim/AlternativeJoa.m3u" -JoakimRemixes = "/playlists/Joakim/JoakimRemixes.m3u" - -# Daniel -DanAwesome = "/playlists/Daniel/Dan - awesome.m3u" -DanDontStarve1 = "/playlists/Daniel/Dan - dontstarve1.m3u" -DanDubstepThingies = "/playlists/Daniel/Dan - dubstepthingies.m3u" -DanEdgyMusicYT = "/playlists/Daniel/Dan - Edgy Music YT.m3u" -DanElectronicRealMusic = "/playlists/Daniel/Dan - electronicrealmusic.m3u" - -# Artists -TaylorSwift = "/playlists/artists/TaylorSwift.m3u" -AstridS = "/playlists/artists/AstridS.m3u" -Coldplay = "/playlists/artists/Coldplay.m3u" -DemiLovato = "/playlists/artists/DemiLovato.m3u" -KatyPerry = "/playlists/artists/KatyPerry.m3u" -SelenaGomez = "/playlists/artists/SelenaGomez.m3u" -ShawnMendes = "/playlists/artists/ShawnMendes.m3u" -ZaraLarsson = "/playlists/artists/ZaraLarsson.m3u" - -# Genres -Musicals = "/playlists/Musicals.m3u" -Soundtracks = "/playlists/Soundtracks.m3u" - -#Events -Halloween = "/playlists/events/Halloween.m3u" - -## END PLAYLISTS - - -randomsong = random(playlist(conservative=true, JoakimDiverse)) -count = list.length(playlist.parse(JoakimDiverse)) - -randomsong = random(weights=[list.length(playlist.parse(AlternativeJoa)), count], [playlist(AlternativeJoa), randomsong]) -count = count + list.length(playlist.parse(AlternativeJoa)) - -randomsong = random(weights=[list.length(playlist.parse(DanAwesome)), count], [playlist(DanAwesome), randomsong]) -count = count + list.length(playlist.parse(DanAwesome)) - -randomsong = random(weights=[list.length(playlist.parse(DanDontStarve1)), count], [playlist(DanDontStarve1), randomsong]) -count = count + list.length(playlist.parse(DanDontStarve1)) - -randomsong = random(weights=[list.length(playlist.parse(DanDubstepThingies)), count], [playlist(DanDubstepThingies), randomsong]) -count = count + list.length(playlist.parse(DanDubstepThingies)) - -randomsong = random(weights=[list.length(playlist.parse(DanEdgyMusicYT)), count], [playlist(DanEdgyMusicYT), randomsong]) -count = count + list.length(playlist.parse(DanEdgyMusicYT)) - -randomsong = random(weights=[list.length(playlist.parse(DanElectronicRealMusic)), count], [playlist(DanElectronicRealMusic), randomsong]) -count = count + list.length(playlist.parse(DanElectronicRealMusic)) - -randomsong = random(weights=[list.length(playlist.parse(TaylorSwift)), count], [playlist(TaylorSwift), randomsong]) -count = count + list.length(playlist.parse(TaylorSwift)) - -randomsong = random(weights=[list.length(playlist.parse(AstridS)), count], [playlist(AstridS), randomsong]) -count = count + list.length(playlist.parse(AstridS)) - -randomsong = random(weights=[list.length(playlist.parse(Coldplay)), count], [playlist(Coldplay), randomsong]) -count = count + list.length(playlist.parse(Coldplay)) - -randomsong = random(weights=[list.length(playlist.parse(DemiLovato)), count], [playlist(DemiLovato), randomsong]) -count = count + list.length(playlist.parse(DemiLovato)) - -randomsong = random(weights=[list.length(playlist.parse(KatyPerry)), count], [playlist(KatyPerry), randomsong]) -count = count + list.length(playlist.parse(KatyPerry)) - -randomsong = random(weights=[list.length(playlist.parse(SelenaGomez)), count], [playlist(SelenaGomez), randomsong]) -count = count + list.length(playlist.parse(SelenaGomez)) - -randomsong = random(weights=[list.length(playlist.parse(ShawnMendes)), count], [playlist(ShawnMendes), randomsong]) -count = count + list.length(playlist.parse(ShawnMendes)) - -randomsong = random(weights=[list.length(playlist.parse(ZaraLarsson)), count], [playlist(ZaraLarsson), randomsong]) -count = count + list.length(playlist.parse(ZaraLarsson)) - -randomsong = random(weights=[list.length(playlist.parse(Musicals)), count], [playlist(Musicals), randomsong]) -count = count + list.length(playlist.parse(Musicals)) - -randomsong = random(weights=[list.length(playlist.parse(Soundtracks)), count], [playlist(Soundtracks), randomsong]) -count = count + list.length(playlist.parse(Soundtracks)) - -randomsong = random(weights=[list.length(playlist.parse(JoakimRemixes)), count], [playlist(JoakimRemixes), randomsong]) -count = count + list.length(playlist.parse(JoakimRemixes)) - -randomsong = random(weights=[list.length(playlist.parse(Halloween)), count], [playlist(Halloween), randomsong]) -count = count + list.length(playlist.parse(Halloween)) - - -randomsong = audio_to_stereo(randomsong) - -### requests = audio_to_stereo(drop_video(request.queue(id="request"))) +jingles = playlist("/jingles/") + +def is_halloween() = + localtime(time(), fun (~sec,~min,~hour,~mday,~mon,~year,~wday,~yday,~isdst) -> + mday >= 22 and mon == 10 and mday <=31) # These are POSIX standards, mon: month of year [0,11] +end + +default = switch([ +({is_halloween()}, random(weights = [1,5], [halloween, normal_songs])), +({true}, normal_songs) +]) + mix = blank() -mix = fallback(track_sensitive=false, [randomsong, mix]) -mix = fallback(track_sensitive=true, transitions=[crossfade], [requests,mix]) +mix = fallback(track_sensitive=false, [default, mix]) +mix = fallback(track_sensitive=true, [requests,mix]) + +mix = random(weights=[9, 1], [mix, jingles]) + mix = fallback(track_sensitive=false, transitions=[crossfade], [live, mix]) + mix = normalize(mix) +mix = audio_to_stereo(mix) # OUTPUTS output.icecast( diff --git a/state/liquidsoap/playlists/events/Halloween.m3u b/state/playlists/events/Halloween.m3u similarity index 100% rename from state/liquidsoap/playlists/events/Halloween.m3u rename to state/playlists/events/Halloween.m3u diff --git a/state/liquidsoap/playlists/normal/Daniel/Dan - awesome.m3u b/state/playlists/normal/Daniel/Dan - awesome.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Daniel/Dan - awesome.m3u rename to state/playlists/normal/Daniel/Dan - awesome.m3u diff --git a/state/liquidsoap/playlists/normal/Daniel/Dan - dontstarve1.m3u b/state/playlists/normal/Daniel/Dan - dontstarve1.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Daniel/Dan - dontstarve1.m3u rename to state/playlists/normal/Daniel/Dan - dontstarve1.m3u diff --git a/state/liquidsoap/playlists/normal/Daniel/Dan - dubstepthingies.m3u b/state/playlists/normal/Daniel/Dan - dubstepthingies.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Daniel/Dan - dubstepthingies.m3u rename to state/playlists/normal/Daniel/Dan - dubstepthingies.m3u diff --git a/state/liquidsoap/playlists/normal/Daniel/Dan - electronicrealmusic.m3u b/state/playlists/normal/Daniel/Dan - electronicrealmusic.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Daniel/Dan - electronicrealmusic.m3u rename to state/playlists/normal/Daniel/Dan - electronicrealmusic.m3u diff --git a/state/liquidsoap/playlists/normal/Joakim/AlternativeJoa.m3u b/state/playlists/normal/Joakim/AlternativeJoa.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Joakim/AlternativeJoa.m3u rename to state/playlists/normal/Joakim/AlternativeJoa.m3u diff --git a/state/liquidsoap/playlists/normal/Joakim/JoakimDiverse.m3u b/state/playlists/normal/Joakim/JoakimDiverse.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Joakim/JoakimDiverse.m3u rename to state/playlists/normal/Joakim/JoakimDiverse.m3u diff --git a/state/liquidsoap/playlists/normal/Joakim/JoakimRemixes.m3u b/state/playlists/normal/Joakim/JoakimRemixes.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Joakim/JoakimRemixes.m3u rename to state/playlists/normal/Joakim/JoakimRemixes.m3u diff --git a/state/liquidsoap/playlists/normal/Musicals.m3u b/state/playlists/normal/Musicals.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Musicals.m3u rename to state/playlists/normal/Musicals.m3u diff --git a/state/liquidsoap/playlists/normal/Soundtracks.m3u b/state/playlists/normal/Soundtracks.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/Soundtracks.m3u rename to state/playlists/normal/Soundtracks.m3u diff --git a/state/liquidsoap/playlists/normal/artists/ArianaGrande.m3u b/state/playlists/normal/artists/ArianaGrande.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/ArianaGrande.m3u rename to state/playlists/normal/artists/ArianaGrande.m3u diff --git a/state/liquidsoap/playlists/normal/artists/AstridS.m3u b/state/playlists/normal/artists/AstridS.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/AstridS.m3u rename to state/playlists/normal/artists/AstridS.m3u diff --git a/state/liquidsoap/playlists/normal/artists/Coldplay.m3u b/state/playlists/normal/artists/Coldplay.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/Coldplay.m3u rename to state/playlists/normal/artists/Coldplay.m3u diff --git a/state/liquidsoap/playlists/normal/artists/DemiLovato.m3u b/state/playlists/normal/artists/DemiLovato.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/DemiLovato.m3u rename to state/playlists/normal/artists/DemiLovato.m3u diff --git a/state/liquidsoap/playlists/normal/artists/KatyPerry.m3u b/state/playlists/normal/artists/KatyPerry.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/KatyPerry.m3u rename to state/playlists/normal/artists/KatyPerry.m3u diff --git a/state/liquidsoap/playlists/normal/artists/SelenaGomez.m3u b/state/playlists/normal/artists/SelenaGomez.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/SelenaGomez.m3u rename to state/playlists/normal/artists/SelenaGomez.m3u diff --git a/state/liquidsoap/playlists/normal/artists/ShawnMendes.m3u b/state/playlists/normal/artists/ShawnMendes.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/ShawnMendes.m3u rename to state/playlists/normal/artists/ShawnMendes.m3u diff --git a/state/liquidsoap/playlists/normal/artists/TaylorSwift.m3u b/state/playlists/normal/artists/TaylorSwift.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/TaylorSwift.m3u rename to state/playlists/normal/artists/TaylorSwift.m3u diff --git a/state/liquidsoap/playlists/normal/artists/ZaraLarsson.m3u b/state/playlists/normal/artists/ZaraLarsson.m3u similarity index 100% rename from state/liquidsoap/playlists/normal/artists/ZaraLarsson.m3u rename to state/playlists/normal/artists/ZaraLarsson.m3u