2018-09-27 14:18:03 +02:00
|
|
|
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"])
|
|
|
|
|
2018-10-04 19:57:39 +02:00
|
|
|
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:<ID>
|
|
|
|
# @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")
|
|
|
|
|
2018-09-27 14:18:03 +02:00
|
|
|
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"
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2018-09-29 23:08:11 +02:00
|
|
|
## BEGIN PLAYLISTS
|
|
|
|
|
|
|
|
# Joakim
|
|
|
|
JoakimDiverse = "/playlists/Joakim/JoakimDiverse.m3u"
|
|
|
|
AlternativeJoa = "/playlists/Joakim/AlternativeJoa.m3u"
|
2018-10-13 22:34:30 +02:00
|
|
|
JoakimRemixes = "/playlists/Joakim/JoakimRemixes.m3u"
|
2018-09-29 23:08:11 +02:00
|
|
|
|
|
|
|
# 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"
|
|
|
|
|
2018-10-13 22:34:30 +02:00
|
|
|
#Events
|
|
|
|
Halloween = "/playlists/events/Halloween.m3u"
|
|
|
|
|
2018-09-29 23:08:11 +02:00
|
|
|
## END PLAYLISTS
|
|
|
|
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(playlist(conservative=true, JoakimDiverse))
|
2018-09-29 23:08:11 +02:00
|
|
|
count = list.length(playlist.parse(JoakimDiverse))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(AlternativeJoa)), count], [playlist(conservative=true, AlternativeJoa), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(AlternativeJoa))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(DanAwesome)), count], [playlist(conservative=true, DanAwesome), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(DanAwesome))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(DanDontStarve1)), count], [playlist(conservative=true, DanDontStarve1), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(DanDontStarve1))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(DanDubstepThingies)), count], [playlist(conservative=true, DanDubstepThingies), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(DanDubstepThingies))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(DanEdgyMusicYT)), count], [playlist(conservative=true, DanEdgyMusicYT), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(DanEdgyMusicYT))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(DanElectronicRealMusic)), count], [playlist(conservative=true,DanElectronicRealMusic), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(DanElectronicRealMusic))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(TaylorSwift)), count], [playlist(conservative=true, TaylorSwift), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(TaylorSwift))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(AstridS)), count], [playlist(conservative=true, AstridS), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(AstridS))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(Coldplay)), count], [playlist(conservative=true, Coldplay), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(Coldplay))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(DemiLovato)), count], [playlist(conservative=true, DemiLovato), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(DemiLovato))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(KatyPerry)), count], [playlist(conservative=true, KatyPerry), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(KatyPerry))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(SelenaGomez)), count], [playlist(conservative=true, SelenaGomez), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(SelenaGomez))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(ShawnMendes)), count], [playlist(conservative=true, ShawnMendes), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(ShawnMendes))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(ZaraLarsson)), count], [playlist(conservative=true, ZaraLarsson), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(ZaraLarsson))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(Musicals)), count], [playlist(conservative=true, Musicals), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(Musicals))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(Soundtracks)), count], [playlist(conservative=true, Soundtracks), randomsong])
|
2018-09-29 23:08:11 +02:00
|
|
|
count = count + list.length(playlist.parse(Soundtracks))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
randomsong = random(weights=[list.length(playlist.parse(JoakimRemixes)), count], [playlist(conservative=true, JoakimRemixes), randomsong])
|
2018-10-13 22:34:30 +02:00
|
|
|
count = count + list.length(playlist.parse(JoakimRemixes))
|
|
|
|
|
2018-10-15 19:00:03 +02:00
|
|
|
#randomsong = random(weights=[list.length(playlist.parse(Halloween)), count], [playlist(conservative=true, Halloween), randomsong])
|
|
|
|
#count = count + list.length(playlist.parse(Halloween))
|
2018-10-13 22:34:30 +02:00
|
|
|
|
2018-09-29 23:08:11 +02:00
|
|
|
|
|
|
|
randomsong = audio_to_stereo(randomsong)
|
|
|
|
|
|
|
|
###
|
2018-09-27 14:18:03 +02:00
|
|
|
requests = audio_to_stereo(drop_video(request.queue(id="request")))
|
|
|
|
|
|
|
|
mix = blank()
|
2018-09-29 23:08:11 +02:00
|
|
|
mix = fallback(track_sensitive=false, [randomsong, mix])
|
|
|
|
mix = fallback(track_sensitive=true, transitions=[crossfade], [requests,mix])
|
2018-09-27 14:18:03 +02:00
|
|
|
mix = fallback(track_sensitive=false, transitions=[crossfade], [live, mix])
|
2018-10-15 19:00:03 +02:00
|
|
|
mix = normalize(mix)
|
2018-09-27 14:18:03 +02:00
|
|
|
|
|
|
|
# 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
|
|
|
|
)
|