Hi ! Le Sunday 19 April 2009 13:08:26 Upp, William, vous avez écrit : > I am looking for some scripting help to play a certain file on a certain > day. What I want to do is, say on Sunday at noon have liquidsoap go and > retrieve a file and play it, then when it is done, return to normal > playing. I have read about being able to play certain playlists at certain > times (like day and night) and I am thinking that altering this script in > some way would do it, but I have not had much luck yet in accomplishing > this.
Indeed, you can use some time-based predicate for building your source with liquidsoap. The syntax and usage of the time predicates is explained at the bottom of this page: http://savonet.sourceforge.net/doc-0.9.0/language.html For instance, if your normal source is s, and your special source is x. If you want that x is played only on sunday at noon, then you can do: s = switch( [ ({0w and 12h},x), (true, s) ] ) However, there are several thing to check to make this work. First, the time predicate 0w and 12h will in fact be true during one hour and you want to play only one song of x. Hence, you should use a delay operator around x: x = delay(3600.,x) This operators will make sure that each time a song is played from x, then after this song, x is not be available for 3600 senconds (one hour). Hence, as soon as one song has been played by x in the switch above, x will not be available and s will be played. Since the delay is one hour, when x is available again, the time predicate is no longer valid such that you are sure that only one song will be played from x. Last thing is about the precise time when the song is played from x. By default, liquidsoap pays attention when a track finishes before switching. This means that is the time predicate for x becomes true, but s is still playing a song, then it will not switch immediately. This has two consequences: * The song from x may not be played exactly on sunday at noon. * If the song played by s lasts for more than one hour, then there will be no switch at all. You can force liquidsoap to switch immediately without paying attention to the tracks by addind the track_sensitive=true option to the switch above. In this case, x will be played immediately when you asked it, and the current track from s will be cut in the middle. This can be made a little bit better by addind a special transition that would make it better, like a crossfade or an intermediate jingle for instance. Hope this helps... Romain ------------------------------------------------------------------------------ Stay on top of everything new and different, both inside and around Java (TM) technology - register by April 22, and save $200 on the JavaOne (SM) conference, June 2-5, 2009, San Francisco. 300 plus technical and hands-on sessions. Register today. Use priority code J9JMT32. http://p.sf.net/sfu/p _______________________________________________ Savonet-users mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/savonet-users
