Le dim. 16 sept. 2018 à 10:15, sébastien dagnicourt <
sebastien.dagnico...@gmail.com> a écrit :
> Already tested it with 30 and 60 seconds. The command took under 10
seconds in a shell so don't know where is my mystake.
> If i check the file i got un /tmp the content is OK !

Ok. Your next step is to check on environment variables. Does your script
rely on some environment variables or specific user to run correctly?

The essential difference between running the script in a shell and inside
the liquidsoap process are the user running it and the environment
variables passed to it.

Inside liquidsoap, user will be whatever it run as and environment variable
should be inherited from the parent liquidsoap process. You should be able
to log those to a tmp file while running your script to check if there is
any significant difference..

> Le dim. 16 sept. 2018 17:02, Romain Beauxis <romain.beau...@gmail.com> a
écrit :
>>
>> Hi,
>>
>> Le dim. 16 sept. 2018 à 09:55, sébastien dagnicourt
>> <sebastien.dagnico...@gmail.com> a écrit :
>> > I made a little script in python to fetch my files from my nextcloud
share.
>> > I add a add_protocol function to fetch them in liquidsoap.
>> > So far it doesn't work in liquidsoap but the command works in a shell.
>> >
>> > Below the code made for testing purpose:
>> >
>> > def nextcloud(~rlog,~maxtime,arg) =
>> >   extname = file.extension(dir_sep="/",arg)
>> >   [process_uri(extname=extname,"/usr/bin/python3 /work/get_file.py
'#{arg}' $(output)")]
>> > end
>> > add_protocol("nc",nextcloud,doc="Fetch files from nextcloud",
syntax="nc://uri")
>> >
>> > default = single("default/single.mp3")
>> > genre1 = playlist("nc://genre1/playlist1.txt")
>> > day     = genre1
>> > night   = genre1
>> > radio = fallback([ request.queue(id="request"),
>> >                     switch([({ 6h-22h }, day),
>> >                             ({ 22h-6h }, night)]),
>> >                     default])
>> > output.alsa(radio)
>> >
>> > Content of the playlist1.txt file:
>> > nc://genre1/file1.mp3
>> > nc://genre1/file2.mp3
>> >
>> > The log file:
>> >
>> > 2018/09/16 16:41:08 [playlist1(dot)txt:3] Loading playlist...
>> > 2018/09/16 16:41:28 [protocol.process:3] Failed to execute
/usr/bin/python3 /work/get_file.py '//genre1/playlist1.txt'
"/tmp/liq-process3ceb08..txt": ("timeout","19.9620351791")
>> > 2018/09/16 16:41:28 [playlist1(dot)txt:2] Failed when resolving
playlist URI "nc://genre1/playlist1.txt"!
>> > 2018/09/16 16:41:28 [playlist1(dot)txt:3] Successfully loaded a
playlist of 0 tracks.
>>
>> Your script looks really good, sounds like a nice feature.
>>
>> It seems that the issue is a timeout: the script takes more than the
default timeout of 20 sec. You may want to increase by setting a different
timeout parameter in your playlist:
>>
>> genre1 = playlist(timeout=<value>, "nc://genre1/playlist1.txt")
>>
>> Hope this helps!
>>
>>
>> Le dim. 16 sept. 2018 à 09:55, sébastien dagnicourt <
sebastien.dagnico...@gmail.com> a écrit :
>>>
>>> Hi,
>>>
>>> I made a little script in python to fetch my files from my nextcloud
share.
>>> I add a add_protocol function to fetch them in liquidsoap.
>>> So far it doesn't work in liquidsoap but the command works in a shell.
>>>
>>> Below the code made for testing purpose:
>>>
>>> def nextcloud(~rlog,~maxtime,arg) =
>>>   extname = file.extension(dir_sep="/",arg)
>>>   [process_uri(extname=extname,"/usr/bin/python3 /work/get_file.py
'#{arg}' $(output)")]
>>> end
>>> add_protocol("nc",nextcloud,doc="Fetch files from nextcloud",
syntax="nc://uri")
>>>
>>> default = single("default/single.mp3")
>>> genre1 = playlist("nc://genre1/playlist1.txt")
>>> day     = genre1
>>> night   = genre1
>>> radio = fallback([ request.queue(id="request"),
>>>                     switch([({ 6h-22h }, day),
>>>                             ({ 22h-6h }, night)]),
>>>                     default])
>>> output.alsa(radio)
>>>
>>> Content of the playlist1.txt file:
>>> nc://genre1/file1.mp3
>>> nc://genre1/file2.mp3
>>>
>>> The log file:
>>>
>>> 2018/09/16 16:41:08 [playlist1(dot)txt:3] Loading playlist...
>>> 2018/09/16 16:41:28 [protocol.process:3] Failed to execute
/usr/bin/python3 /work/get_file.py '//genre1/playlist1.txt'
"/tmp/liq-process3ceb08..txt": ("timeout","19.9620351791")
>>> 2018/09/16 16:41:28 [playlist1(dot)txt:2] Failed when resolving
playlist URI "nc://genre1/playlist1.txt"!
>>> 2018/09/16 16:41:28 [playlist1(dot)txt:3] Successfully loaded a
playlist of 0 tracks.
>>>
>>> _______________________________________________
>>> Savonet-users mailing list
>>> Savonet-users@lists.sourceforge.net
>>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>>
>> _______________________________________________
>> Savonet-users mailing list
>> Savonet-users@lists.sourceforge.net
>> https://lists.sourceforge.net/lists/listinfo/savonet-users
>
> _______________________________________________
> Savonet-users mailing list
> Savonet-users@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/savonet-users
_______________________________________________
Savonet-users mailing list
Savonet-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/savonet-users

Reply via email to