Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/liquidsoap
- #------------------------------------------------------------------------------
- # server configuration data
- # Use the telnet server for requests
- set("server.telnet", true)
- set("server.telnet.port",1976)
- # and the harbor info for a live takeover
- set("harbor.port",8050)
- set("harbor.password","hackme")
- #------------------------------------------------------------------------------
- # this function will add the ID to the meta data
- def add_meta(s, data)
- rewrite_metadata([("source",data)],s)
- end
- #------------------------------------------------------------------------------
- # the main music playlists
- # the base playlist, songs 2-4 minutes in length from a master archive
- edh_base = playlist(reload = 600, "~radio/base.pls")
- # some star trek music, because this is a Star Trek station!!!
- edh_startrek = playlist(reload = 600, "~radio/st.pls")
- # then mix it together, about 1 ST song for every 4 normal songs, 20% hopefully
- # I am using random instead of rotate so that is feels a bit more organic
- edh_playlist = add_meta(random( weights = [1, 4],[edh_startrek, edh_base]), "Backup")
- #------------------------------------------------------------------------------
- # the request stuff, and putting the music together
- # a place to put listener requests, there is more music than in the base and st
- # this will be a php website that has a list of all the music, and just adds
- # it to "request.push <url>" via the telnet interface as requested
- edh_requests = request.queue(id="request")
- # the real fallback, if everything else blows up
- edh_emergency = single("~radio/music/Emergency.mp3")
- # the music playlist put together
- edh_music = fallback( [ edh_requests, edh_playlist, edh_emergency])
- #------------------------------------------------------------------------------
- # now add the IDs and commercials/PSAs into rotation
- # the commercials are fake in character commercials for the game
- #the files
- edh_stationIDs = playlist(reload = 600, "~radio/ids.pls")
- edh_commercials = playlist(reload = 600, "~radio/adds.pls")
- # every 4 songs, play a short 5 second station ID
- edh_ided_music = rotate( weights = [1, 4],[edh_stationIDs, edh_music])
- # every 20 songs (4 song + 1 ID 4 times) play two commercials which are aprox 30 seconds in length
- edh_radio = add_meta(rotate( weights = [20, 2],[edh_ided_music, edh_commercials]), "EDH")
- # for the record, EDH is "Emergency DJ Hologram"
- #------------------------------------------------------------------------------
- # Stream the EDH/Jukebox/AutoDJ out
- # currently disabled, but this would be a pure jukebox stream if people wanted to
- # ignore the DJs
- #output.icecast.mp3(
- # host = "localhost", port = 8040, bitrate = 128, public = false,
- # url = "http://www.risa-radio.com", description = "Risa Radio",
- # password = "hackme", mount = "/edh.mp3", restart = true,
- # edh_radio)
- #------------------------------------------------------------------------------
- # now we get all of the available DJ streams
- #these are any http inputs... it could be icecast2, or shoutcast, or even harbors if we wanted
- dj01_Raw = add_meta(input.http( "http://localhost:8040/dj01.mp3"), "DJ01")
- dj02_Raw = add_meta(input.http( "http://localhost:8040/dj02.mp3"), "DJ02")
- dj03_Raw = add_meta(input.http( "http://localhost:8040/dj03.mp3"), "DJ03")
- dj04_Raw = add_meta(input.http( "http://localhost:8040/dj04.mp3"), "DJ04")
- dj05_Raw = add_meta(input.http( "http://localhost:8040/dj05.mp3"), "DJ05")
- dj06_Raw = add_meta(input.http( "http://localhost:8040/dj06.mp3"), "DJ06")
- dj07_Raw = add_meta(input.http( "http://localhost:8040/dj07.mp3"), "DJ07")
- dj08_Raw = add_meta(input.http( "http://localhost:8040/dj08.mp3"), "DJ08")
- dj09_Raw = add_meta(input.http( "http://localhost:8040/dj09.mp3"), "DJ09")
- dj10_Raw = add_meta(input.http( "http://localhost:8040/dj10.mp3"), "DJ10")
- #and connect to them, so that when we switch, there is no connection lag
- output.dummy(fallible=true,dj01_Raw)
- output.dummy(fallible=true,dj02_Raw)
- output.dummy(fallible=true,dj03_Raw)
- output.dummy(fallible=true,dj04_Raw)
- output.dummy(fallible=true,dj05_Raw)
- output.dummy(fallible=true,dj06_Raw)
- output.dummy(fallible=true,dj07_Raw)
- output.dummy(fallible=true,dj08_Raw)
- output.dummy(fallible=true,dj09_Raw)
- output.dummy(fallible=true,dj10_Raw)
- # now make each stream have a backup of generic music
- # we also want this to be track insensitive, so it switches back right away
- # this is just the edh_playlist, not the full EDH stream, i don't want it consuming requests
- dj01 = fallback( id = "DJ01", track_sensitive=false, [ dj01_Raw, edh_playlist])
- dj02 = fallback( id = "DJ02", track_sensitive=false, [ dj02_Raw, edh_playlist])
- dj03 = fallback( id = "DJ03", track_sensitive=false, [ dj03_Raw, edh_playlist])
- dj04 = fallback( id = "DJ04", track_sensitive=false, [ dj04_Raw, edh_playlist])
- dj05 = fallback( id = "DJ05", track_sensitive=false, [ dj05_Raw, edh_playlist])
- dj06 = fallback( id = "DJ06", track_sensitive=false, [ dj06_Raw, edh_playlist])
- dj07 = fallback( id = "DJ07", track_sensitive=false, [ dj07_Raw, edh_playlist])
- dj08 = fallback( id = "DJ08", track_sensitive=false, [ dj08_Raw, edh_playlist])
- dj09 = fallback( id = "DJ09", track_sensitive=false, [ dj09_Raw, edh_playlist])
- dj10 = fallback( id = "DJ10", track_sensitive=false, [ dj10_Raw, edh_playlist])
- #------------------------------------------------------------------------------
- # build a switch to switch between the DJs and the EDH
- # first the functions for the switch
- # A call to a external scripts to see if source should be streaming
- # this is a really fast external script
- def is_s(source) =
- fun () -> test_process("~radio/djcheck #{source.id(source)}")
- end
- # then to make sure the final one always is true
- def is_true() =
- fun () -> true
- end
- # and then a switch to select them
- dj_switch = switch(
- [ (is_s(dj01),dj01), (is_s(dj02),dj02),
- (is_s(dj03),dj03), (is_s(dj04),dj04),
- (is_s(dj05),dj05), (is_s(dj06),dj06),
- (is_s(dj07),dj07), (is_s(dj08),dj08),
- (is_s(dj09),dj09), (is_s(dj10),dj10),
- (is_true(),edh_radio)] )
- #------------------------------------------------------------------------------
- # now the live override
- # this is a master override, we can hook in and take it all over
- live = add_meta(input.harbor("live.mp3"), "Live")
- # now the actual radio stream....
- radio = fallback(track_sensitive=false, [live,dj_switch])
- #------------------------------------------------------------------------------
- # now log the metadata as it streams by
- # this function will send the metadata to an external script, which will run
- # in the background, so this can be a slower script
- def feedback_metadata(m)
- system( "~radio/songChange #{quote(m['source'])} #{quote(m['artist'])} #{quote(m['title'])} &")
- end
- radio = on_metadata(feedback_metadata, radio)
- #------------------------------------------------------------------------------
- # now output this "radio" stream to the master relays. These could be icecase,
- # shoutcast, basically any ouput types supported by LIQ
- output.icecast.mp3(
- host = "localhost", port = 8000, bitrate = 128,
- url = "http://www.risa-radio.com", description = "Risa Radio",
- password = "hackme", mount = "/live.mp3", restart = true,
- radio)
- #output.icecast.mp3(
- # host = "otakuvideo.com", port = 8000, bitrate = 32,
- # url = "http://www.risa-radio.com", description = "Risa Radio",
- # password = "hackme", mount = "/low_live.mp3", restart = true,
- # radio)
- #------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement