mirror of
https://github.com/ytdl-org/youtube-dl.git
synced 2025-08-22 14:24:03 -07:00
Fixed missing imports, ran Flake8 over the fille.
This commit is contained in:
parent
de3865fec0
commit
9ca71e76ba
1 changed files with 7 additions and 5 deletions
|
@ -18,6 +18,8 @@ from ..utils import (
|
|||
)
|
||||
|
||||
from base64 import b64encode
|
||||
from shutil import copyfile
|
||||
|
||||
|
||||
class EmbedThumbnailPPError(PostProcessingError):
|
||||
pass
|
||||
|
@ -129,15 +131,15 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
|
|||
elif info['ext'] in ['opus', 'ogg', 'flac']:
|
||||
try:
|
||||
from mutagen.oggvorbis import OggVorbis
|
||||
from mutagen.oggopus import OggOpus
|
||||
from mutagen.flac import Picture, FLAC
|
||||
from mutagen.oggopus import OggOpus
|
||||
from mutagen.flac import Picture, FLAC
|
||||
except ImportError:
|
||||
raise EmbedThumbnailPPError('mutagen was not found. Please install.')
|
||||
|
||||
# to prevent the behaviour of in-place modification of Mutagen
|
||||
shutil.copyfile(filename, temp_filename)
|
||||
copyfile(filename, temp_filename)
|
||||
|
||||
aufile = {'opus': OggOpus, 'flac': FLAC, 'ogg', OggVorbis}[info['ext']](temp_filename)
|
||||
aufile = {'opus': OggOpus, 'flac': FLAC, 'ogg': OggVorbis}[info['ext']](temp_filename)
|
||||
|
||||
covart = Picture()
|
||||
covart.data = open(thumbnail_filename, 'rb').read()
|
||||
|
@ -151,7 +153,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
|
|||
|
||||
self._downloader.to_screen('[mutagen] Adding thumbnail to "%s"' % temp_filename)
|
||||
aufile.save()
|
||||
|
||||
|
||||
if not self._already_have_thumbnail:
|
||||
os.remove(encodeFilename(thumbnail_filename))
|
||||
os.remove(encodeFilename(filename))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue