Hi!

I need to run a script that does two things everytime a song is played. The
way I managed to do so is a mess and I'd like to know if there is any
"cleaner" way to do that.

Here is a chunk of my liquidsoap script:

musicas = mean(mksafe(playlist(mode="normal",
"/home/radio/var/nextsong.txt")))
live = input.harbor("/",port=8080,password="*******",icy=true)

radio = fallback(track_sensitive=false, [live, musicas])

def nowpl(m)
  musica = '#{m["artist"]} - #{m["title"]}'
  system("/home/radio/scripts/nowplaying #{quote(musica)}")
end

radio = on_metadata(nowpl,radio)

The /home/radio/scripts/nowplaying script sets the metadata in my website
(this is pretty right) but also updates the file
/home/radio/var/nextsong.txt with the URI for the next song, then asks
liquidsoap to reaload the playlist through unix socket and Voilla! The next
song will be the one with the URI inside nextsong.txt

Is it efficient? I don't like this idea because when I go live, the
metadata is update so the script asks for the next song and that song is
ever going to be played.
Sorry if my english is confusing, I'm trying to do my best!

Best regards.

*

Leonel Rocha
*
------------------------------------------------------------------------------
Keep Your Developer Skills Current with LearnDevNow!
The most comprehensive online learning library for Microsoft developers
is just $99.99! Visual Studio, SharePoint, SQL - plus HTML5, CSS3, MVC3,
Metro Style Apps, more. Free future releases when you subscribe now!
http://p.sf.net/sfu/learndevnow-d2d
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to