CONDITIONAL SCHEDULING OF PLAYLISTS #3975
Replies: 5 comments 4 replies
-
Hi @glenbuck1, def jingles_schedule()
time1 = time.predicate("1w21h30m-1w22h")
time2 = time.predicate("3w11h")
not time1() and not time2()
end
jingles = switch([(jingles_schedule, jingles)]) I use
|
Beta Was this translation helpful? Give feedback.
-
Thanks for the suggestion of using time.predicate(); I did this but got an odd outcome with the 'time2' slot mentioned below. The playlist for The playlist for The playlist for Do you have any idea, please, why a jingle was inserted in #Playlists
jingles=audio_to_stereo(mksafe(normalize(playlist(mode="random", "/home/richard/jingles"))))
SixtiesPlus=audio_to_stereo(mksafe(normalize(playlist(mode="random", "/home/richard/music"))))
CueAlbum="/home/richard/firepit/AlbumTrackin240615.cue"
AlbumTrackin = playlist(CueAlbum, loop=false, mode="normal")
CueJazz="/home/richard/firepit/AllThatJazz240515.cue"
AllThatJazz = playlist(CueJazz, loop=false, mode="normal")
CueStandard="/home/richard/firepit/StandardTime240619.cue"
StandardTime = playlist(CueStandard, loop=false, mode="normal")
CueMotown="/home/richard/firepit/MotownShow240616.cue"
MotownShow=playlist(CueMotown, loop=false, mode="normal")
#Scheduling
Tuesday=mksafe(switch(track_sensitive=false, [({0h-12h05m}, SixtiesPlus), ({12h35m-13h35m}, AllThatJazz), ({13h35m-17h}, SixtiesPlus), ({17h-19h}, AlbumTrackin), ({19h-20h}, SixtiesPlus), ({20h-21h}, MotownShow), ({21h-0h}, SeventiesPlus)]))
def jingles_schedule()
time1 = time.predicate("2w12h35m-2w13h35m")
time2 = time.predicate("2w17h-2w19h")
time3 = time.predicate("2w20h-2w21h")
time4 = time.predicate("3w15h-3w17h")
not time1() and not time2() and not time3() and not time4()
end
jingles = switch([(jingles_schedule, jingles)])
radio=mksafe(switch(track_sensitive=false, [({1w}, Monday), ({2w}, Tuesday), ({3w}, Wednesday), ({4w}, Thursday), ({5w}, Friday), ({6w}, Saturday), ({7w}, Sunday)]))
radio=mksafe(crossfade(smart=true, rotate(weights=[4,1], [radio, jingles]))) |
Beta Was this translation helpful? Give feedback.
-
Thanks for this...I need to think about your example a bit more as, at the moment, I don't think I understand how to use it! :-) As far as switching jingles on and off, after more testing today, it does seem to be purely at the transition stage from jingles to no jingles. Prior to a show starting at 15:00, I had a jingle followed by two songs; then a part song leading up to 15:00. When the show began at 15:0, it was preceded by a jingle and then the show played with no jingles as wanted. If you can't think of a reliable way to stop and start jingles, I think there's little hope for me so I may have to resort to a cruder method; for example:
I can't thank you enough for all your time and effot spent on this. Assuming what I want to do can't currently be achieved, would you consider it to be a reasonable feature request? |
Beta Was this translation helpful? Give feedback.
-
I've yet to manage to get the fallback option working as I have shows to play on multiple days and not just on a Tuesday. So, for the meantime, I've opted to turn jingles off 30 minutes before the start of each show so that the transition to a new show doesn't run the risk of inserting a jingle after the first or second song from the cue sheet! I shall keep working on alternative approaches and really appreciate all your advice. One last question...since upgrading to Liquidsoap 2.2.5, I've noticed that it takes about 10 seconds for music to begin playing as opposed to four seconds on the earlier 2.0.3.1. Is there a way I could speed up the loading of the script, please, eg pre-processing it? Thanks again. |
Beta Was this translation helpful? Give feedback.
-
Good to know that the startup delay is being addressed. Thanks for alternative suggestion to fallback, too. Many thanks to all for help. |
Beta Was this translation helpful? Give feedback.
-
Hi,
At present, I have the following lines in my script file:
radio=mksafe(switch(track_sensitive=false, [({1w}, Monday), ({2w}, Tuesday), ({3w}, Wednesday), ({4w}, Thursday), ({5w}, Friday), ({6w}, Saturday), ({7w}, Sunday)]))
radio=mksafe(crossfade(smart=true, rotate(weights=[4,1], [radio, jingles])))
output.icecast(%mp3(bitrate=192), fallible=true, name="autodj Test", host="listen.phoenixradio1208.com", password="", port=8030, mount="testautodj", radio)
This works perfectly well as it goes; however, now I also want to be able to play some streams in a day with no rotation of jingles mixed in with them!
I can do this by having different scripts scheduled via cron but wondered if there is a way to do this within a script using conditional statements. I've tried the likes of:
radio=mksafe(switch(track_sensitive=false, [({1w}, Monday), ({2w}, Tuesday), ({3w}, Wednesday), ({4w}, Thursday), ({5w}, Friday), ({6w}, Saturday), ({7w}, Sunday)]))
MyDay = time.local().day
MyHour = time.local().hour
MyMin = time.local().min
if (MyDay == 1) then
if (MyHour == 21 and MyMin == 30) then
radio=mksafe(crossfade(smart=true, radio))
end
elsif (MyDay == 3) then
if (MyHour == 11 and MyMin == 0) then
radio=mksafe(crossfade(smart=true, radio))
end
else
radio=mksafe(crossfade(smart=true, rotate(weights=[4,1], [radio, jingles])))
end
output.icecast(%mp3(bitrate=192), fallible=true, name="autodj Test", host="listen.phoenixradio1208.com", password="", port=8030, mount="testautodj", radio)
However, the script just sits there seeming to do nothing!
Are the if statements executed only once at time of script launch and/or is there a way of doing what I want within a script, please?
Thanks for any help.
Richard Bartholomew
Beta Was this translation helpful? Give feedback.
All reactions