Fix detecting wrong file, embed thumbnails
This commit is contained in:
parent
cb2dbde126
commit
c57009b77f
13
badwitch.py
13
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']])
|
||||
|
Loading…
Reference in New Issue
Block a user