Hi,

For those who don't speak French, Antoine has a solution for doing
custom authentication on harbor, coupled with a mechanism for adding
jingles "smoothly" on top of the live, where the jingles depend on the
current user streaming the live. He posted some code and asked for
comments.

Antoine, you already have some PHP for authentication, I think it
makes sense to use it for the jingle selection. The code you have is
almost working, there's just one problem:

> def jingle_live() =
>         r = list.hd(get_process_lines("php /var/www/webradio/jingle.php
> #{user}"))
>         request.create(r)
> end

In this function, the variable user is not defined. What you need to
do is add a global reference current_user = ref "" at the beginning of
your script, and update this global variable with the value of user at
each call of the authentication, by doing current_user := user in
auth(). Then you can read the reference in jingle_live(), use
!current_user instead of user.

> j_live=request.dynamic(jingle_live)

A secondary comment here: request.dynamic() will prepare jingles in
advance, so the first jingle of the next user could be a jingle
prepared for the previous user. To avoid this you would need to flush
the queue, but there is unfortunately no server command for doing this
yet. We should add it; can you switch to the development version of
our source code?

> j_live=single("path/to/#{user}.mp3")

This alternative is good too, simpler than the previous one if you
really want to play always the same file for a given user. It has the
same problem with preparing files in advance, though.

Other options are to (1) switch to using a queue where you would push
requests, instead of request.dynamic pulling on your PHP script, and
you would have server commands for flusing (2) use a playlist based on
the user, change it and reload it when the user changes, which would
force flushing the queue automatically.

Have fun,
-- 
David

------------------------------------------------------------------------------
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
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to