Hi Rafael,

Thanks for sharing some code, it's always useful.

On Mon, Aug 23, 2010 at 12:49 AM, rafael <[email protected]> wrote:
> teste = request.dynamic({ request.create("bar:foo", indicators=
> get_process_lines("python list.py"))})

I'm not sure that this is doing what you have in mind: This source
calls your script for each track. Each call yields a list of files,
which are understood by liquidsoap as alternatives, not as a sequence.
The first file that is recognized by liquidsoap will be played, then
the script will be called again. Since your script randomizes the
listing, the result is effectively random, although not exactly
"shuffled".

The playlist() operator already can already perform shuffling (this is
the default, mode="randomize"). Your script does one more thing: it
selects only *.mp3, which saves some time. You could achieve the same
by first creating a protocol for creating (temporary) playlist files
using a variation of your script that: (1) prepares the listing,
shuffled or not (2) gets a new temporary file name (3) writes the
listing to that file and (4) just returns this listing. Then the
protocol is used for generating the playlist passed to the playlist
operator:

  add_protocol(temporary=true,"myplaylist",
    fun (_,_) -> [get_process_output("python list.py")])
  playlist("myplaylist:foo") # probably also works without foo, I'll
leave that detail out

Here the script would be called only once. Since I didn't override the
"mode" parameter of playlist(), the list would be shuffled, and
re-shuffled after every full pass. You can disable that, and you could
also use the reload parameters to call your script after each pass to
get a new listing.

Hope that helps,

David

------------------------------------------------------------------------------
This SF.net email is sponsored by 

Make an app they can't live without
Enter the BlackBerry Developer Challenge
http://p.sf.net/sfu/RIM-dev2dev 
_______________________________________________
Savonet-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to