Hi all,Here's a more precise description of the system that we use for dolebrai.net.
First, we define a source "s" that produces tracks to be played. This is a request.dynamic() source that gets its next track from a perl script that relies on our database. Then the source is coupled with a queue for direct scheduling, and a default file. All this is wrapped in an amplify() that works on replay_gain data.
Obviously you might build your base source differently. Maybe just a playlist, maybe some special effects, etc. Now we're going to hook some things on it. The following piece of code should deal with the source s when it's still a track source. Cross-fading and such should be done later. (The amplify() could as well be done later too, btw.)
<----------- <define here the relevant values for the variable scripts and last_xml> # Feedback is provided for any file played, # be it from scheduler.pl, user request via the queue # or the default file. # By the way we refresh the XML describing the latest tracks. def feedback(m)system("#{scripts}/feedback.pl #{quote(m['filename'])} 2>> #{scripts}/logf")
system("#{scripts}/last.rb > #{last_xml}")
end
# Add a telnet control to get info before metadata rewriting, used by
last.rb
s = store_metadata(size=20,id="history",s) s = on_metadata(feedback,s) ----------->What this piece of code does is wrap s in two more operators. (1) The store_metadata() remembers the last 20 metadata chunks, and makes them available via telnet -- note that such features are packed with most outputs, it might suit your needs. (2) The on_metadata operator calls a script whenever a new metadata chunk passes through the pipes, i.e. for every new track.
The feedback() function does two things. (1) It passes the filename to feedback.pl, a script that updates our database to notify that the file has been played. Your don't necessarily need that kind of device; it's conceptually attached to our scheduler.pl script and that isn't the topic of this mail. (2) It calls last.rb which is a ruby script that gets from telnet the metadata of the last 20 tracks, and creates an XML file from them. This script is attached. You'll notice that it also gets the number of listener from icecast and puts it in the XML file.
Finally, the information from the XML file is read from our HTML pages. You can look at the source of http://dolebrai.net, the function install_info() from http://dolebrai.net/site_media/javascript/liquidsoap.js is called on load, and schedules itself automatically for periodical updates. The function is provided with identifiers of <div> elements of the page that should receive the various informations (number of listener, current title).
Now, I wish you good luck trying all this. I hope you'll enjoy it. Bear in mind that these scripts were not meant for public release, they are not necessarily super polished and detailed. You might have to adapt a few things, but not so much for a first result I think.
Cheers, David
last.rb
Description: application/ruby
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july
_______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
