Hi Dave,
Thanks a lot for helping me learn more about liquidsoap. It is also
being a practical school for me to learn more about functional languages
(should not have missed those classes :) ).
I am using the playlist operator for simple task, but I am starting
to use python scripts so I can make more complex behaviours (and also
because I love python).
I am now studying the example you wrote. As far as I understand:
add_protocol(temporary=true,"myplaylist", fun (_,_) ->
[get_process_output("python list.py")])
in an imperative language would be analogue to:
myplaylist = get_process_output("python list.py")
Is this what add_protocol function exists for? Setting variable values?
Also, one of the behaviours I expect (and this is why I used
request.dynamic in the first place) is to permit someone to change a
playlist (let's say a jingle folder), just by moving files from and to
that folder (through ftp, for example). This is for someone that can't
code at all be able to control what is being played. In the example you
wrote, you tell me that the script would be called only once. So could I
have this behaviour with your example? This is why you advice me to use
a reload parameter? Would this solve it?
Thanks,
Rafael
Em 23-08-2010 03:24, David Baelde escreveu:
> 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