[embedthumbnai] Ran flake8 over the code and fixed according to its standard.

This commit is contained in:
Tryamid 2020-03-10 08:04:15 +05:30
parent cbe64c52c1
commit 982f386fdf

View File

@ -91,22 +91,22 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
else: else:
os.remove(encodeFilename(filename)) os.remove(encodeFilename(filename))
os.rename(encodeFilename(temp_filename), encodeFilename(filename)) os.rename(encodeFilename(temp_filename), encodeFilename(filename))
elif info['ext'] in ['opus', 'ogg', 'flac']: elif info['ext'] in ['opus', 'ogg', 'flac']:
try: try:
from mutagen.oggvorbis import OggVorbis from mutagen.oggvorbis import OggVorbis
from mutagen.oggopus import OggOpus from mutagen.oggopus import OggOpus
from mutagen.flac import Picture, FLAC from mutagen.flac import Picture, FLAC
except ImportError: except ImportError:
raise EmbedThumbnailPPError('mutagen was not found. Please install.') raise EmbedThumbnailPPError('mutagen was not found. Please install.')
shutil.copyfile(filename, temp_filename) shutil.copyfile(filename, temp_filename)
aufile = {'opus': OggOpus, 'flac': FLAC, 'ogg': OggVorbis} \ aufile = ({'opus': OggOpus, 'flac': FLAC, 'ogg': OggVorbis}
[info['ext']](temp_filename) [info['ext']](temp_filename))
covart = Picture() covart = Picture()
covart.data = open(thumbnail_filename, 'rb').read() covart.data = open(thumbnail_filename, 'rb').read()
covart.type = 3 # Cover (front) covart.type = 3 # Cover (front)
# Since, OGGOpus and OGGVorbis doesn't natively support # Since, OGGOpus and OGGVorbis doesn't natively support
# (coverart / thumbnail)s, it's wrapped in if..else # (coverart / thumbnail)s, it's wrapped in if..else
@ -115,7 +115,7 @@ class EmbedThumbnailPP(FFmpegPostProcessor):
else: else:
aufile['metadata_block_picture'] = \ aufile['metadata_block_picture'] = \
base64.b64encode(covart.write()).decode('ascii') base64.b64encode(covart.write()).decode('ascii')
# Save changes to temporary file, it'd be overlapped as the # Save changes to temporary file, it'd be overlapped as the
# original one. # original one.
aufile.save() aufile.save()