Fix detecting wrong file, embed thumbnails

This commit is contained in:
Salt 2020-03-06 04:03:07 -06:00
parent cb2dbde126
commit c57009b77f

View File

@ -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']])