Fully fleshed-out playlist importer

Hell yeah
This commit is contained in:
Salt 2020-03-13 06:21:37 -05:00
parent 8d20962afc
commit 6dc1efaab6

View File

@ -304,6 +304,8 @@ class BadWitch:
return
def playlist(self, lib):
print('Bad Witch playlist importer')
print('Loaded library ' + lib.file)
in_playlist = input('YouTube Playlist URL: ')
playlist = {}
metadata = {}
@ -331,6 +333,7 @@ class BadWitch:
if 'album' in item and album == '':
print('Detected album title ' + entries[i]['album'])
album = entries[i]['album']
# Sometimes this just comes back None
if 'release_date' in item and 'release_date' not in metadata and entries[i]['release_date'] is not None:
print('Detected release date ' + entries[i]['release_date'])
metadata['release_date'] = entries[i]['release_date']
@ -358,13 +361,12 @@ class BadWitch:
'source': songcontent['source']
}
lib.albums[album] = playlistalbum
lib.validate()
lib.save()
print('Successfully added "' + album + '" by ' + artist)
print(f'Successfully added "{album}" by {artist}')
for song, songcontent in lib.albums[album].items():
if song == 'meta':
continue
print(str(songcontent['track']) + ': ' + song + ' (' + songcontent['source'] + ')')
lib.save()
def prompt(self, lib):
print('Bad Witch interactive library editor')