Advertisement
Guest User

LIQ Switchboard Log

a guest
Jun 19th, 2010
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.51 KB | None | 0 0
  1. #!/usr/bin/liquidsoap
  2.  
  3. #------------------------------------------------------------------------------
  4. # server configuration data
  5.  
  6. # Use the telnet server for requests
  7. set("server.telnet", true)
  8. set("server.telnet.port",1976)
  9.  
  10. # and the harbor info for a live takeover
  11. set("harbor.port",8050)
  12. set("harbor.password","hackme")
  13.  
  14. #------------------------------------------------------------------------------
  15. # this function will add the ID to the meta data
  16.  
  17. def add_meta(s, data)
  18. rewrite_metadata([("source",data)],s)
  19. end
  20.  
  21. #------------------------------------------------------------------------------
  22. # the main music playlists
  23.  
  24. # the base playlist, songs 2-4 minutes in length from a master archive
  25. edh_base = playlist(reload = 600, "~radio/base.pls")
  26.  
  27. # some star trek music, because this is a Star Trek station!!!
  28. edh_startrek = playlist(reload = 600, "~radio/st.pls")
  29.  
  30. # then mix it together, about 1 ST song for every 4 normal songs, 20% hopefully
  31. # I am using random instead of rotate so that is feels a bit more organic
  32. edh_playlist = add_meta(random( weights = [1, 4],[edh_startrek, edh_base]), "Backup")
  33.  
  34. #------------------------------------------------------------------------------
  35. # the request stuff, and putting the music together
  36.  
  37. # a place to put listener requests, there is more music than in the base and st
  38. # this will be a php website that has a list of all the music, and just adds
  39. # it to "request.push <url>" via the telnet interface as requested
  40. edh_requests = request.queue(id="request")
  41.  
  42. # the real fallback, if everything else blows up
  43. edh_emergency = single("~radio/music/Emergency.mp3")
  44.  
  45. # the music playlist put together
  46. edh_music = fallback( [ edh_requests, edh_playlist, edh_emergency])
  47.  
  48. #------------------------------------------------------------------------------
  49. # now add the IDs and commercials/PSAs into rotation
  50. # the commercials are fake in character commercials for the game
  51.  
  52. #the files
  53. edh_stationIDs = playlist(reload = 600, "~radio/ids.pls")
  54. edh_commercials = playlist(reload = 600, "~radio/adds.pls")
  55.  
  56. # every 4 songs, play a short 5 second station ID
  57. edh_ided_music = rotate( weights = [1, 4],[edh_stationIDs, edh_music])
  58.  
  59. # every 20 songs (4 song + 1 ID 4 times) play two commercials which are aprox 30 seconds in length
  60. edh_radio = add_meta(rotate( weights = [20, 2],[edh_ided_music, edh_commercials]), "EDH")
  61. # for the record, EDH is "Emergency DJ Hologram"
  62.  
  63. #------------------------------------------------------------------------------
  64. # Stream the EDH/Jukebox/AutoDJ out
  65.  
  66. # currently disabled, but this would be a pure jukebox stream if people wanted to
  67. # ignore the DJs
  68.  
  69. #output.icecast.mp3(
  70. # host = "localhost", port = 8040, bitrate = 128, public = false,
  71. # url = "http://www.risa-radio.com", description = "Risa Radio",
  72. # password = "hackme", mount = "/edh.mp3", restart = true,
  73. # edh_radio)
  74.  
  75. #------------------------------------------------------------------------------
  76. # now we get all of the available DJ streams
  77.  
  78. #these are any http inputs... it could be icecast2, or shoutcast, or even harbors if we wanted
  79. dj01_Raw = add_meta(input.http( "http://localhost:8040/dj01.mp3"), "DJ01")
  80. dj02_Raw = add_meta(input.http( "http://localhost:8040/dj02.mp3"), "DJ02")
  81. dj03_Raw = add_meta(input.http( "http://localhost:8040/dj03.mp3"), "DJ03")
  82. dj04_Raw = add_meta(input.http( "http://localhost:8040/dj04.mp3"), "DJ04")
  83. dj05_Raw = add_meta(input.http( "http://localhost:8040/dj05.mp3"), "DJ05")
  84. dj06_Raw = add_meta(input.http( "http://localhost:8040/dj06.mp3"), "DJ06")
  85. dj07_Raw = add_meta(input.http( "http://localhost:8040/dj07.mp3"), "DJ07")
  86. dj08_Raw = add_meta(input.http( "http://localhost:8040/dj08.mp3"), "DJ08")
  87. dj09_Raw = add_meta(input.http( "http://localhost:8040/dj09.mp3"), "DJ09")
  88. dj10_Raw = add_meta(input.http( "http://localhost:8040/dj10.mp3"), "DJ10")
  89.  
  90. #and connect to them, so that when we switch, there is no connection lag
  91. output.dummy(fallible=true,dj01_Raw)
  92. output.dummy(fallible=true,dj02_Raw)
  93. output.dummy(fallible=true,dj03_Raw)
  94. output.dummy(fallible=true,dj04_Raw)
  95. output.dummy(fallible=true,dj05_Raw)
  96. output.dummy(fallible=true,dj06_Raw)
  97. output.dummy(fallible=true,dj07_Raw)
  98. output.dummy(fallible=true,dj08_Raw)
  99. output.dummy(fallible=true,dj09_Raw)
  100. output.dummy(fallible=true,dj10_Raw)
  101.  
  102. # now make each stream have a backup of generic music
  103. # we also want this to be track insensitive, so it switches back right away
  104. # this is just the edh_playlist, not the full EDH stream, i don't want it consuming requests
  105. dj01 = fallback( id = "DJ01", track_sensitive=false, [ dj01_Raw, edh_playlist])
  106. dj02 = fallback( id = "DJ02", track_sensitive=false, [ dj02_Raw, edh_playlist])
  107. dj03 = fallback( id = "DJ03", track_sensitive=false, [ dj03_Raw, edh_playlist])
  108. dj04 = fallback( id = "DJ04", track_sensitive=false, [ dj04_Raw, edh_playlist])
  109. dj05 = fallback( id = "DJ05", track_sensitive=false, [ dj05_Raw, edh_playlist])
  110. dj06 = fallback( id = "DJ06", track_sensitive=false, [ dj06_Raw, edh_playlist])
  111. dj07 = fallback( id = "DJ07", track_sensitive=false, [ dj07_Raw, edh_playlist])
  112. dj08 = fallback( id = "DJ08", track_sensitive=false, [ dj08_Raw, edh_playlist])
  113. dj09 = fallback( id = "DJ09", track_sensitive=false, [ dj09_Raw, edh_playlist])
  114. dj10 = fallback( id = "DJ10", track_sensitive=false, [ dj10_Raw, edh_playlist])
  115.  
  116. #------------------------------------------------------------------------------
  117. # build a switch to switch between the DJs and the EDH
  118.  
  119. # first the functions for the switch
  120. # A call to a external scripts to see if source should be streaming
  121. # this is a really fast external script
  122. def is_s(source) =
  123. fun () -> test_process("~radio/djcheck #{source.id(source)}")
  124. end
  125. # then to make sure the final one always is true
  126. def is_true() =
  127. fun () -> true
  128. end
  129.  
  130. # and then a switch to select them
  131. dj_switch = switch(
  132. [ (is_s(dj01),dj01), (is_s(dj02),dj02),
  133. (is_s(dj03),dj03), (is_s(dj04),dj04),
  134. (is_s(dj05),dj05), (is_s(dj06),dj06),
  135. (is_s(dj07),dj07), (is_s(dj08),dj08),
  136. (is_s(dj09),dj09), (is_s(dj10),dj10),
  137. (is_true(),edh_radio)] )
  138.  
  139. #------------------------------------------------------------------------------
  140. # now the live override
  141.  
  142. # this is a master override, we can hook in and take it all over
  143. live = add_meta(input.harbor("live.mp3"), "Live")
  144.  
  145. # now the actual radio stream....
  146. radio = fallback(track_sensitive=false, [live,dj_switch])
  147.  
  148. #------------------------------------------------------------------------------
  149. # now log the metadata as it streams by
  150.  
  151. # this function will send the metadata to an external script, which will run
  152. # in the background, so this can be a slower script
  153. def feedback_metadata(m)
  154. system( "~radio/songChange #{quote(m['source'])} #{quote(m['artist'])} #{quote(m['title'])} &")
  155. end
  156.  
  157. radio = on_metadata(feedback_metadata, radio)
  158.  
  159. #------------------------------------------------------------------------------
  160. # now output this "radio" stream to the master relays. These could be icecase,
  161. # shoutcast, basically any ouput types supported by LIQ
  162.  
  163. output.icecast.mp3(
  164. host = "localhost", port = 8000, bitrate = 128,
  165. url = "http://www.risa-radio.com", description = "Risa Radio",
  166. password = "hackme", mount = "/live.mp3", restart = true,
  167. radio)
  168.  
  169. #output.icecast.mp3(
  170. # host = "otakuvideo.com", port = 8000, bitrate = 32,
  171. # url = "http://www.risa-radio.com", description = "Risa Radio",
  172. # password = "hackme", mount = "/low_live.mp3", restart = true,
  173. # radio)
  174.  
  175. #------------------------------------------------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement