Hi Andre!
2012/3/23 Andre Castro <[email protected]>:
> guess this might be a simple question.
>
> As it is now rotate, rotates between playing one item from the 1st playlist
> and then playing an item from the 2nd playlist in the list, continuously
> rotating between one and the other.
>
> What if I want to keep playing the 1st playlist the list for the whole
> duration of time (from 30m to 40m), and only the next time will i play the
> next 2nd playlist in the list?
>
>
>
> Here's the code as I have it:
>
> code_poker = rotate([playlist_code, playlist_poker])
>
>
>
> radio = fallback([ request.queue(id="request"),
> switch([({ 0m-15m }, p_news),
> ({ 10m-13m }, p_weather),
> ({ 13m-30m }, cooking),
> ({ 30m-40m }, code_poker),
> ({ 40m-0m }, french)
> ]), default
> ])
I'm not sure that I understand exactly what you want to do but keep in
mind that switch accepts any functional predicates.
Therefore, if you switch rules become more complex, you may as well
write your own switching functions, which should allow you more
flexibility.. For instance:
def news_switch() =
(.. returns true when p_news source should be played ..)
end
def weather_news() =
(....)
end
(...)
radio = fallback([ request.queue(id="request"),
switch([(new_switch, p_news),
(weather_switch, p_weather),
(...)
You can also use time predicate in those functions:
def time_and_something_else() =
if 10h00-10h05 then
(.. some other condition ..)
else
false
end
end
Romain
------------------------------------------------------------------------------
This SF email is sponsosred by:
Try Windows Azure free for 90 days Click Here
http://p.sf.net/sfu/sfd2d-msazure
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users