Fully fleshed-out playlist importer
Hell yeah
This commit is contained in:
		| @@ -304,6 +304,8 @@ class BadWitch: | |||||||
|             return |             return | ||||||
|  |  | ||||||
|     def playlist(self, lib): |     def playlist(self, lib): | ||||||
|  |         print('Bad Witch playlist importer') | ||||||
|  |         print('Loaded library ' + lib.file) | ||||||
|         in_playlist = input('YouTube Playlist URL: ') |         in_playlist = input('YouTube Playlist URL: ') | ||||||
|         playlist = {} |         playlist = {} | ||||||
|         metadata = {} |         metadata = {} | ||||||
| @@ -331,6 +333,7 @@ class BadWitch: | |||||||
|                     if 'album' in item and album == '': |                     if 'album' in item and album == '': | ||||||
|                         print('Detected album title ' + entries[i]['album']) |                         print('Detected album title ' + entries[i]['album']) | ||||||
|                         album = 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: |                     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']) |                         print('Detected release date ' + entries[i]['release_date']) | ||||||
|                         metadata['release_date'] = entries[i]['release_date'] |                         metadata['release_date'] = entries[i]['release_date'] | ||||||
| @@ -358,13 +361,12 @@ class BadWitch: | |||||||
|                 'source': songcontent['source'] |                 'source': songcontent['source'] | ||||||
|                 } |                 } | ||||||
|         lib.albums[album] = playlistalbum |         lib.albums[album] = playlistalbum | ||||||
|         lib.validate() |         print(f'Successfully added "{album}" by {artist}') | ||||||
|         lib.save() |  | ||||||
|         print('Successfully added "' + album + '" by ' + artist) |  | ||||||
|         for song, songcontent in lib.albums[album].items(): |         for song, songcontent in lib.albums[album].items(): | ||||||
|             if song == 'meta': |             if song == 'meta': | ||||||
|                 continue |                 continue | ||||||
|             print(str(songcontent['track']) + ': ' + song + ' (' + songcontent['source'] + ')') |             print(str(songcontent['track']) + ': ' + song + ' (' + songcontent['source'] + ')') | ||||||
|  |         lib.save() | ||||||
|  |  | ||||||
|     def prompt(self, lib): |     def prompt(self, lib): | ||||||
|         print('Bad Witch interactive library editor') |         print('Bad Witch interactive library editor') | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user