adds basic playlist building and writing to files
This commit is contained in:
parent
0ad1e107a8
commit
3e38c98c3b
|
@ -17,7 +17,17 @@ def main():
|
|||
for single_date in daterange(from_date, to_date):
|
||||
if verbose:
|
||||
print("Processing date", single_date)
|
||||
build_day(single_date)
|
||||
daylist = build_day(single_date)
|
||||
|
||||
daylist_path = playlistdir + "/" + channel + "/" + single_date.strftime("%Y") + "/" + single_date.strftime("%m") + "/" + single_date.strftime("%d") + "/"
|
||||
if not os.path.isdir(daylist_path):
|
||||
os.makedirs(daylist_path)
|
||||
daylist_file = single_date.strftime("%Y") + "-" + single_date.strftime("%m") + "-" + single_date.strftime("%d") + ".json"
|
||||
with open(daylist_path + daylist_file, "w") as file:
|
||||
file.write(daylist)
|
||||
|
||||
if verbose:
|
||||
print('wrote playlist file', daylist_path + daylist_file)
|
||||
|
||||
def parse_config():
|
||||
global mediadir, playlistdir, channel, verbose, from_date, to_date, playlist_duration
|
||||
|
@ -77,8 +87,11 @@ def build_day(this_date):
|
|||
|
||||
# TODO: see if playlist_duration is a factor of 24 * 60 * 60 and, if so, duplicate it to fill 24 hours
|
||||
|
||||
playlist = json.dumps(d)
|
||||
if verbose:
|
||||
print("playlist json:", json.dumps(d))
|
||||
print("playlist json:", playlist)
|
||||
|
||||
return playlist
|
||||
|
||||
def get_playlist_entry():
|
||||
entry = {
|
||||
|
|
Loading…
Reference in New Issue