Hello all,

I am looking for some help dealing with reloading a playlist from the start on a
source change. I am running Liquidsoap 1.0.1 compiled from source on FC17.

Here is a copy of my test .liq file with passwords and hosts removed.

-- Start --
#!/usr/local/bin/liquidsoap -v -d -T -U

set("tag.encodings",["UTF-8","ISO-8859-1"])
set("log.file.path","/path/to/test/log/Test.log")
set("init.daemon",true)
set("log.stdout",false)
set("log.file",true)
set("init.daemon.pidfile.path","/path/to/pid/Test.pid")
set("log.level",9)

live =
mksafe(input.http(id="Live","http://Username:[email protected]:80/live.mp3";))

live = drop_metadata(live)

channel = rewrite_metadata([                   ("artist","I am on LIVE"),
                                                ("title","Live")],
                                                live)

replay_files =
mksafe(playlist(id="Files",mode="normal","/path/to/playlists/Test.pls"))

replay_files = rewrite_metadata([        ("artist","I am on FILES"),
                                                ("title","FILES")],
                                                replay_files)


times =  fallback([ switch(track_sensitive=false,
                                [
                                ({ 0m-2m }, live),
                                ({ 2m-4m }, replay_files),
                                ({ 4m-6m }, live),
                                ({ 6m-8m }, replay_files),

-- SNIP --

                                ({ 54m-56m }, replay_files),
                                ({ 56m-58m }, live),
                                ({ 58m-0m }, replay_files)]),
                                replay_files])


output.icecast(%mp3(stereo=false,bitrate=16,samplerate=16000),
     name="Test", url="http://www.host.com/";,
     description="Test",genre="Test",
     host = "icecast.host.com", password = "(Password)",fallible=true, 
start=true,
     port=80, mount="/Test1.mp3",
     times
     )

output.icecast(%mp3(stereo=false,bitrate=64,samplerate=44100),
     name="Test", url="http://www.host.com/";,
     description="Test",genre="Test",
     host = "icecast.host.com", password = "(Password)",fallible=true, 
start=true,
     port=80, mount="/Test2.mp3",
     times
     )

output.dummy(fallible=true,channel)

-- End --

In this .liq everything works as I would expect. Once ever 2 minutes liquidsoap
happily switches from one source to another sends them off to the Icecast mount
points. However when it switches back to "replay_files" from "Live" it picks up
right where it left off at in "replay_files". This is the behavior I would like
to modify, restart the playlist to the very beginning. 

After reading other threads in the mailing list I did find this.

server.execute("#{source.id(replay_files)}.reload")

This sounds like what I need, however I am unsure how to make it work with times
=  fallback([ switch(track_sensitive=false, ....  or is it even possible?

I did find this code snip however as my Ocaml skills are nil to poor at best I
am not sure how to modify it or if I am even looking at the right thing for that
matter.

def reload_on_change(s)
  last_seen = ref("")
  def handler(m)
    id = m["source"]
    old_id = !last_seen
    if old_id != id then
      last_seen := id
      if old_id != "" then
        log("Reloading #{old_id}...")
        list.iter(log,server.execute("#{old_id}.reload"))
      end
    end
  end
  on_track(handler,s)
end

times = reload_on_change(times)

I found this at http://comments.gmane.org/gmane.comp.audio.liquidsoap.user/4412
however this seems to deal more with playlists rather then switching from a live
source back to files.

Thanks for any help for suggestions

- Tie



 


------------------------------------------------------------------------------
Got visibility?
Most devs has no idea what their production app looks like.
Find out how fast your code is with AppDynamics Lite.
http://ad.doubleclick.net/clk;262219671;13503038;y?
http://info.appdynamics.com/FreeJavaPerformanceDownload.html
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to