Hi Cris,

2012/5/18 Chris Rimmer <[email protected]>:
> I'm building a highly dynamic streaming system using Liquidsoap, so that the
> sources are built and populated with requests dynamically. The app (written
> in Django) needs to receive a notification when the a new track starts
> playing. So what I did is add a callback URL as metadata on the request and
> then do http.get on this URL as follows:
>
> callback_timeout=5.0
>
> def track_notification(m) =
>   callback_url = m["callback_url"]
>   if string.length(callback_url) > 0 then
>     print("Callback to #{callback_url}")
>     ignore(http.get(timeout=callback_timeout,callback_url))
>   end
> end
>
> and when I build the source I call on_track to attach track_notification as
> a callback. This all works unless liquidsoap doesn't like the url, in which
> case it exits with the following in the logs:
>
> 2012/05/18 16:18:28 [clock.wallclock_main:2] Source blah failed while
> streaming: Failure("Invalid URL.")!
> 2012/05/18 16:18:28 [clock.wallclock_main:3] Raised at file "pervasives.ml",
> line 22, characters 22-33
> 2012/05/18 16:18:28 [clock.wallclock_main:3] Called from file "list.ml",
> line 57, characters 20-23
> 2012/05/18 16:18:28 [blah:3] Closing connection...
> 2012/05/18 16:18:28 [blah_q:3] Finished with "myfile.mp3".
> 2012/05/18 16:18:28 [clock.wallclock_main:3] Streaming loop stopped.
> 2012/05/18 16:18:28 [main:3] Shutdown started!
> 2012/05/18 16:18:28 [threads:3] Thread "wallclock_main" terminated (0
> remaining).
> 2012/05/18 16:18:28 [main:3] Waiting for threads to terminate...
> 2012/05/18 16:18:28 [main:3] Cleaning downloaded files...
> 2012/05/18 16:18:28 >>> LOG END
>
> Have I misunderstood something, or is there a better way to do this?

This is a great and timely catch! It will get fixed very soon..

BTW: I have also been working on a json-based liquidsoap controler, there:
  https://github.com/savonet/liquidsoap-controler
And a corresponding nodeJS module there:
  https://github.com/savonet/node-liquidsoap

This is still relatively experimental code but perhaps it could give
you ideas.. It does not have track callbacks yet tho..

Romain

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to