Replies: 13 comments
-
Well interestingly, I just wrote the following test: https://github.com/savonet/liquidsoap/blob/master/scripts/tests/BUG403.liq Does this code makes sense to you? It tracks which sources are played in the rotation. You could adapt it to track which tracks are played in your rotate and flip a switch to make it unavailable.. Something like: joyful_ready = ref true
def f(_) =
[("id","playlist_1")]
end
playlist_1 = map_metadata(f,playlist_1)
def f(_) =
[("id","playlist_2")]
end
playlist_2 = map_metadata(f,playlist_2)
def f(_) =
[("id","radio")]
end
radio = map_metadata(f,radio)
Joyful = rotate(weights=[1, 1, 1], [playlist_1, playlist_2, radio])
selected = ref []
def f(m) =
selected := list.cons(m["id"],!selected)
s = list.rev(!selected)
if list.nth(default="",s,0) == "playlist_1" and
list.nth(default="",s,1) == "playlist_2" and
list.nth(default="",s,2) == "radio" then
joyful_ready := false
end
end
Joyful = on_track(f,Joyful)
Joyful = switch([{!joyful_ready}, Joyful)])
radio = switch(track_sensitive=true, [
({ 7w and 0m - 5m }, Joyful ),
({true}, radio)]) Couple of questions:
|
Beta Was this translation helpful? Give feedback.
-
Thank you Romain. Unfortunately, I did not manage to get the code run in the AzuraCast environment, I get an error for undefined var at line: selected := list.cons(m["id"],!selected) and a syntax error for the line: Joyful = switch([{!joyful_ready}, Joyful)]) With regards to your questions:
Every hour for two days per week.
Indeed, actually Joyful (as well as three more similar sources) will be the result by rotating more than 30 playlists. Anyway, isn't it a bit a lengthy solution especially when it comes to rotating a big number of playlists? I suggest a simple operator to stop the rotation after playing and the last playlist in the row would be the simplest approach. Thanks for the great support. |
Beta Was this translation helpful? Give feedback.
-
Hi Romain, allow me to ask again about this issue, is it considered in the coming 1.4.2 release? |
Beta Was this translation helpful? Give feedback.
-
Hi @pavlos2. This looks more like a user feature than an issue. The general philosophy of our operators is that "simple things should be simple but complex things should be possible". Here, I think it applies pretty well by letting the user implement their own specific use of the base operator. In your case, I believe that you need a little more massaging of the API to implement what you need. If I understand correctly, you want:
For 1., assuming your tracks are less than For 2.,
Now, you can refine your switch and do:
I think a simple idea would be to use a repeated call back. Something like this:
Altogether:
I haven't tested this script but at least it should be syntactically correct this time :-) |
Beta Was this translation helpful? Give feedback.
-
Hi @toots. Totally agree with your words "The general philosophy of our operators is that "simple things should be simple but complex things should be possible". Allow me to seize the opportunity at this point and say I think a more detailed manual for Liquidsoap, as well as an online testing environment, would help a lot. Also, thanks for providing the above solution, although it did not work because of a timer error given by the cross operator I will keep digging into that. |
Beta Was this translation helpful? Give feedback.
-
Hi,
I get the following nested clocks error:
I presume the code provided by @toots is correct, then is it something wrong with AzuraCast? |
Beta Was this translation helpful? Give feedback.
-
Hi! What is the definition of |
Beta Was this translation helpful? Give feedback.
-
Hi Romain! The source
The error persists even is if Thanks for the support! |
Beta Was this translation helpful? Give feedback.
-
This issue is now fixed. Romain was right the presence of The next challenge on this matter is how to modify the above code so that to include more sources in the
Thanks for the support! |
Beta Was this translation helpful? Give feedback.
-
Hi Romain, After your remarkable contribution, and of course continuous support, to fix the memory issue I wonder if I can have some further help with the above code you kindly provided back in May. More specific, I need to add more sources (as depicted below) and that produces the fatal error "a source cannot belong to two clocks". I read the online help on Nested Clocks but I am afraid I will need for once more your help. Here is a sample of the code I would like to use:
Regards, |
Beta Was this translation helpful? Give feedback.
-
Hi! The problem that you are having is that |
Beta Was this translation helpful? Give feedback.
-
Hi Romain! Thanks for the response, I have already tried couple of alterations in the script (mainly changing the name of the sources) after reading the online help on Nested Clocks. Nope, I still get the error "a source cannot belong to two clocks". Could you please help further on this matter? |
Beta Was this translation helpful? Give feedback.
-
Hi, can I have some further help on this matter please? |
Beta Was this translation helpful? Give feedback.
-
Hi,
I'm trying to figure out how to fix the following code so that after playing one random track from playlist_1, one random track from playlist_2, and finally one random track from radio to exit
rotate()
.Thanks in advance!
Beta Was this translation helpful? Give feedback.
All reactions