adds logic to loop playlist to fill 24 hours if playlist_duration is a factor of 24*60*60

This commit is contained in:
Sundog 2023-10-06 14:02:36 -04:00
parent 7f26c1aa98
commit fc177d69e4
1 changed files with 14 additions and 1 deletions

View File

@ -106,7 +106,20 @@ def build_day(this_date):
if verbose: if verbose:
print(' added program:', json.dumps(entry), length) print(' added program:', json.dumps(entry), length)
# TODO: see if playlist_duration is a factor of 24 * 60 * 60 and, if so, duplicate it to fill 24 hours day_length = 24 * 60 * 60
if day_length % playlist_duration == 0:
if verbose:
print("looping playlist...")
iterations = (day_length / playlist_duration)
iteration = d["program"] # snapshot of the unit of iteration
looped = []
if verbose:
print("iteration: ", json.dumps(iteration, indent=4))
print("iterations: ", iterations)
while iterations > 0:
looped.extend(iteration)
iterations -= 1
d["program"] = looped
playlist = json.dumps(d) playlist = json.dumps(d)
if verbose: if verbose: