From a8731fcc1d11afe0c6c3e349d0c85d32ed17488a Mon Sep 17 00:00:00 2001 From: pukkandan Date: Wed, 11 Aug 2021 13:42:23 +0530 Subject: [PATCH] minor bugfixes bugs due to be2fc5b212338d89d9c139cb463f785e797d1ad3, e9f4ccd19eb92621970b518fb5984b8aef52bdc8 --- yt_dlp/extractor/common.py | 4 ++-- yt_dlp/postprocessor/ffmpeg.py | 2 +- yt_dlp/postprocessor/metadataparser.py | 8 ++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/yt_dlp/extractor/common.py b/yt_dlp/extractor/common.py index 9cc3051c4..8c2566dc5 100644 --- a/yt_dlp/extractor/common.py +++ b/yt_dlp/extractor/common.py @@ -2599,8 +2599,8 @@ def extract_Initialization(source): codecs = representation_attrib.get('codecs', '') if content_type not in ('video', 'audio', 'text'): if mime_type == 'image/jpeg': - content_type = 'image/jpeg' - if codecs.split('.')[0] == 'stpp': + content_type = mime_type + elif codecs.split('.')[0] == 'stpp': content_type = 'text' else: self.report_warning('Unknown MIME type %s in DASH manifest' % mime_type) diff --git a/yt_dlp/postprocessor/ffmpeg.py b/yt_dlp/postprocessor/ffmpeg.py index 24466f21c..1d21ffaf2 100644 --- a/yt_dlp/postprocessor/ffmpeg.py +++ b/yt_dlp/postprocessor/ffmpeg.py @@ -592,7 +592,7 @@ def add(meta_list, info_list=None): metadata_filename = replace_extension(filename, 'meta') with io.open(metadata_filename, 'wt', encoding='utf-8') as f: def ffmpeg_escape(text): - return re.sub(r'(=|;|#|\\|\n)', r'\\\1', text) + return re.sub(r'([\\=;#\n])', r'\\\1', text) metadata_file_content = ';FFMETADATA1\n' for chapter in chapters: diff --git a/yt_dlp/postprocessor/metadataparser.py b/yt_dlp/postprocessor/metadataparser.py index 4d3c0e0ed..f7b0d8bde 100644 --- a/yt_dlp/postprocessor/metadataparser.py +++ b/yt_dlp/postprocessor/metadataparser.py @@ -64,10 +64,10 @@ def interpretter(self, inp, out): def f(info): outtmpl, tmpl_dict = self._downloader.prepare_outtmpl(template, info) data_to_parse = self._downloader.escape_outtmpl(outtmpl) % tmpl_dict - self.write_debug(f'Searching for r{out_re.pattern!r} in {template!r}') + self.write_debug(f'Searching for {out_re.pattern!r} in {template!r}') match = out_re.search(data_to_parse) if match is None: - self.report_warning('Could not interpret {inp!r} as {out!r}') + self.report_warning(f'Could not interpret {inp!r} as {out!r}') return for attribute, value in match.groupdict().items(): info[attribute] = value @@ -86,12 +86,12 @@ def f(info): elif not isinstance(val, str): self.report_warning(f'Cannot replace in field {field} since it is a {type(val).__name__}') return - self.write_debug(f'Replacing all r{search!r} in {field} with {replace!r}') + self.write_debug(f'Replacing all {search!r} in {field} with {replace!r}') info[field], n = search_re.subn(replace, val) if n: self.to_screen(f'Changed {field} to: {info[field]}') else: - self.to_screen(f'Did not find r{search!r} in {field}') + self.to_screen(f'Did not find {search!r} in {field}') search_re = re.compile(search) return f