From 8297e51b34cebe71244cc27fd9dad4a82fffa1ab Mon Sep 17 00:00:00 2001 From: Rohit Date: Fri, 29 Dec 2023 02:05:07 +0530 Subject: [PATCH] trying to correct formatting --- yt_dlp/postprocessor/embedthumbnail.py | 5 +++-- yt_dlp/postprocessor/ffmpeg.py | 6 ++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/yt_dlp/postprocessor/embedthumbnail.py b/yt_dlp/postprocessor/embedthumbnail.py index a3605e9ab5..48c8abfede 100644 --- a/yt_dlp/postprocessor/embedthumbnail.py +++ b/yt_dlp/postprocessor/embedthumbnail.py @@ -93,7 +93,8 @@ def run(self, info): # Using ffmpeg to embed the thumbnail in mp3 files is messing up lyrics # Using using mutagen instead audio = mutagen.id3.ID3(filename) - if 'APIC' in audio:del audio['APIC'] + if 'APIC' in audio: + del audio['APIC'] with open(thumbnail_filename, 'rb') as thumbfile: audio['APIC'] = mutagen.id3.APIC( encoding=3, mime='image/%s' % thumbnail_ext, type=3, @@ -218,7 +219,7 @@ def run(self, info): else: raise EmbedThumbnailPPError('Supported filetypes for thumbnail embedding are: mp3, mkv/mka, ogg/opus/flac, m4a/mp4/m4v/mov') - if info['ext']!='mp3' and success and temp_filename != filename: + if info['ext'] != 'mp3' and success and temp_filename != filename: os.replace(temp_filename, filename) self.try_utime(filename, mtime, mtime) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 05ce9f5639..a88009a510 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -59,6 +59,8 @@ 'alac': ('m4a', None, ('-acodec', 'alac')), 'wav': ('wav', None, ('-f', 'wav')), } + + def create_mapping_re(supported): return re.compile(r'{0}(?:/{0})*$'.format(r'(?:\s*\w+\s*>)?\s*(?:%s)\s*' % '|'.join(supported))) @@ -585,7 +587,7 @@ def _options(target_ext): class FFmpegEmbedSubtitlePP(FFmpegPostProcessor): - AUDIO_EXTS = ('mp3','m4a','flac','opus') + AUDIO_EXTS = ('mp3', 'm4a', 'flac', 'opus') SUPPORTED_EXTS = ('mp4', 'mov', 'm4a', 'webm', 'mkv', 'mka') def __init__(self, downloader=None, already_have_subtitle=False): @@ -674,7 +676,7 @@ def embed_lyrics(self, input_files): raise PostProcessingError('LRC subtitles required. Use "--convert-subs lrc" to convert') else: with open(subs, 'r', encoding='utf-8') as f: - lyrics=f.read().strip() + lyrics = f.read().strip() if audio_file.endswith('.mp3'): audio = mutagen.id3.ID3(audio_file) audio.add(mutagen.id3.USLT(encoding=3, lang='eng', desc='', text=lyrics))