IT WORKS
Now for ID3
This commit is contained in:
		| @@ -64,10 +64,11 @@ class Library: | |||||||
|             destpath = (Path.home() / 'Music' / artist / album) |             destpath = (Path.home() / 'Music' / artist / album) | ||||||
|             Path(destpath).mkdir(parents=True, exist_ok=True) |             Path(destpath).mkdir(parents=True, exist_ok=True) | ||||||
|             for song, songcontent in albumcontent.items(): |             for song, songcontent in albumcontent.items(): | ||||||
|  |                 destfile = str(destpath / song) + '.%(ext)s' | ||||||
|                 # See if we already have  it |                 # See if we already have  it | ||||||
|                 matches = sorted(Path(destpath).glob(song + '.*')) |                 matches = sorted(Path(destpath).glob(song + '.*')) | ||||||
|                 if not matches == []: |                 if not matches == []: | ||||||
|                     logging.debug('Using cached song: ' + song) |                     logging.info('Already have song: ' + song) | ||||||
|                     continue |                     continue | ||||||
|                 # Download the song |                 # Download the song | ||||||
|                 ytdl_opts = { |                 ytdl_opts = { | ||||||
| @@ -77,8 +78,9 @@ class Library: | |||||||
|                             'preferredcodec': 'opus', |                             'preferredcodec': 'opus', | ||||||
|                             'preferredquality': '192' |                             'preferredquality': '192' | ||||||
|                             }], |                             }], | ||||||
|                         'extract_audio': True, |                         'quiet': True, | ||||||
|                         'playlist_items': 1, |                         'playlist_items': 1, | ||||||
|  |                         'outtmpl': destfile | ||||||
|                         } |                         } | ||||||
|                 with youtube_dl.YoutubeDL(ytdl_opts) as ydl: |                 with youtube_dl.YoutubeDL(ytdl_opts) as ydl: | ||||||
|                     ydl.download([songcontent['source']]) |                     ydl.download([songcontent['source']]) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user