diff --git a/badwitch.py b/badwitch.py index a98a17f..b02d416 100755 --- a/badwitch.py +++ b/badwitch.py @@ -80,21 +80,24 @@ class Library: destfile = str(destpath / filename) + '.%(ext)s' logging.debug('Saving to: ' + destfile) # See if we already have it - if Path(str(destpath / song) + '.mp3').exists(): + if Path(str(destpath / filename) + '.mp3').exists(): # Skip downloading logging.info('Already have song: ' + song) else: # Download the song ytdl_opts = { 'format': 'bestaudio', + 'outtmpl': destfile, + 'playlist_items': 1, + 'quiet': True, + 'writethumbnail': True, 'postprocessors': [{ 'key': 'FFmpegExtractAudio', 'preferredcodec': 'mp3', 'preferredquality': '192' - }], - 'quiet': True, - 'playlist_items': 1, - 'outtmpl': destfile + },{ + 'key': 'EmbedThumbnail' + }] } with youtube_dl.YoutubeDL(ytdl_opts) as ydl: ydl.download([songcontent['source']])