adds logic to loop playlist to fill 24 hours if playlist_duration is a factor of 24*60*60
This commit is contained in:
		| @ -106,7 +106,20 @@ def build_day(this_date): | ||||
|         if verbose: | ||||
|             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) | ||||
|     if verbose: | ||||
|  | ||||
		Reference in New Issue
	
	Block a user