Don't like ads? PRO users don't see any ads ;-)
Guest

Airtime/liquidsoap with replay gain

By: a guest on Apr 4th, 2011  |  syntax: None  |  size: 2.91 KB  |  hits: 329  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. %include "library/pervasives.liq"
  2. %include "/etc/airtime/liquidsoap.cfg"
  3.  
  4. set("log.file.path", log_file)
  5. set("log.stdout", true)
  6. set("server.telnet", true)
  7. set("server.telnet.port", 1234)
  8.  
  9. queue = request.queue(id="queue", length=0.5)
  10. queue = audio_to_stereo(queue)
  11.  
  12. pypo_data = ref '0'
  13. web_stream_enabled = ref false
  14. stream_metadata_type = ref 0
  15. station_name = ref ''
  16. show_name = ref ''
  17.  
  18. %include "ls_lib.liq"
  19.  
  20. server.register(namespace="vars", "pypo_data", fun (s) -> begin pypo_data := s "Done" end)
  21. server.register(namespace="vars", "web_stream_enabled", fun (s) -> begin web_stream_enabled := (s == "true") string_of(!web_stream_enabled) end)
  22. server.register(namespace="vars", "stream_metadata_type", fun (s) -> begin stream_metadata_type := int_of_string(s) s end)
  23. server.register(namespace="vars", "show_name", fun (s) -> begin show_name := s s end)
  24. server.register(namespace="vars", "station_name", fun (s) -> begin station_name := s s end)
  25.  
  26.  
  27. default = amplify(0.00001, noise())
  28. default = rewrite_metadata([("artist","Airtime"), ("title", "offline")],default)
  29.  
  30. s = fallback(track_sensitive=false, [queue, default])
  31. enable_replaygain_metadata ()
  32. s = amplify(1.,override="replay_gain",s)
  33. s = on_metadata(notify, s)
  34. s = crossfade(s)
  35. # Attach a skip command to the source s:
  36.  
  37. #web_stream_source = input.http(id="web_stream", autostart = false, buffer=0.5, max=20., "")
  38.  
  39. #once the stream is started, give it a sink so that liquidsoap doesn't
  40. #create buffer overflow warnings in the log file.
  41. #output.dummy(fallible=true, web_stream_source)
  42.  
  43. #s = switch(track_sensitive = false,
  44. #    transitions=[to_live,to_live],
  45. #    [
  46. #      ({ !web_stream_enabled }, web_stream_source),
  47. #      ({ true }, s)
  48. #    ]
  49. #)
  50.  
  51. add_skip_command(s)
  52. s = map_metadata(append_title, s)
  53.  
  54.  
  55. if output_sound_device then
  56.         out_device = out(s)
  57. end
  58.  
  59. if output_icecast_mp3 then
  60.         out_mp3 = output.icecast(%mp3,
  61.                         host = icecast_host, port = icecast_port,
  62.                         password = icecast_pass, mount = mount_point_mp3,
  63.                         fallible = true,
  64.                         restart = true,
  65.                         restart_delay = 5,
  66.                         url = icecast_url,
  67.                         description = icecast_description,
  68.                         genre = icecast_genre,
  69.                         s)
  70. end
  71.  
  72. if output_icecast_aacplus then
  73.         out_vorbis = output.icecast(%aacplus(channels=2, samplerate=44100, bitrate=64),
  74.                         host = icecast_host, port = icecast_port,
  75.                         password = icecast_pass, mount = mount_point_aacplus,
  76.                         fallible = true,
  77.                         restart = true,
  78.                         restart_delay = 5,
  79.                         url = icecast_url,
  80.                         description = icecast_description,
  81.                         genre = icecast_genre,
  82.                         s)
  83. end