Feature Request: Date Ranges as Switch Predicates #2179
Replies: 4 comments 3 replies
-
I'm adding no new requirement to the above; but since I'm the original broadcaster seeking this capability I thought I would provide more background info on this issue. Here's my "user story": As a station manager I want a particular playlist to play on a specific date at a specific time so that I can arrange in advance for a specific audio file to be played on that specific date-time. My particular use case: I have pre-recorded "shows" that I want to broadcast on a pre-advertised date/time. Consider the following advertisement we might run on our station: "At 7pm tonight and tomorrow night, the station is going to broadcast a recording of the live show from artist ABC! Tune in for these two nights only!" (The playlist will contain first the station ident, then a (2-hour) recorded file.) Note that for my use case, the "ending" date is much less important than the ability to assure the playback is kicked off on the scheduled days. (There may be other cases, though, that want more capability; I'm just sharing my need.) |
Beta Was this translation helpful? Give feedback.
-
Hi all. The details for this are perhaps specific to each implementation but our responsibility is to provide the tools that are needed to make it possible. I had a review of the current API and:
All that is good but we were still missing a way to compare local time, so I have added:
Finally, the API to use with these functions was taken directly from posix and was confusing for non-unix programmers so I changed the method names and value range. With all this, it should be easy to write predicates such as: # This is in local time:
def true_on_january_first_2023() =
start = time.make({
# Detect DST
dst = null(),
year = 2023,
month = 1,
day = 1,
hour = 0,
min = 0,
sec = 0
})
stop = time.make({
# Detect DST
dst = null(),
year = 2023,
month = 1,
day = 1,
hour = 23,
min = 59,
sec = 59
})
current_time = time()
start <= current_time and current_time <= stop
end |
Beta Was this translation helpful? Give feedback.
-
@toots Thanks for the analysis & additions. Not being a coder (these days; I was in the past), I'm a BIT fuzzy on where you left this. Are the things above done, merged, and you expect them to be in a minor release? If so, which one (so I can know to get Buster to help me test them)? |
Beta Was this translation helpful? Give feedback.
-
I missed that discussion, and I like it, I sometimes found myself requiring a restart just to enable a given switch() element for a given date / week, then restart again to turn it off… which is not always welcome… That will help… |
Beta Was this translation helpful? Give feedback.
-
Liquidsoap can currently do hour, minute, day and "day of the week" as predicates for switches (i.e. to schedule playlists for playback in certain time periods), but it doesn't appear it's currently possible to specify a calendar date range, i.e. to only play a switch while after
2022-01-01
but before2022-02-01
.This would be very helpful for users who want to schedule their calendars rather far out in advance, and for whom their scheduled entries are often specific to a certain holiday or special event.
Beta Was this translation helpful? Give feedback.
All reactions