From 337734d4a8a6500bc65434843db346b5cbd05e81 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Thu, 6 Jul 2023 20:09:42 +0530 Subject: [PATCH] [cleanup] Misc --- devscripts/make_changelog.py | 7 ++++--- setup.cfg | 1 - yt_dlp/YoutubeDL.py | 2 +- yt_dlp/downloader/common.py | 3 ++- yt_dlp/downloader/fragment.py | 4 +--- yt_dlp/extractor/adobepass.py | 2 +- yt_dlp/extractor/iqiyi.py | 2 +- yt_dlp/extractor/vshare.py | 2 +- yt_dlp/extractor/youtube.py | 2 +- yt_dlp/utils/__init__.py | 1 + 10 files changed, 13 insertions(+), 13 deletions(-) diff --git a/devscripts/make_changelog.py b/devscripts/make_changelog.py index eb0e3082f..3ad4c5408 100644 --- a/devscripts/make_changelog.py +++ b/devscripts/make_changelog.py @@ -55,6 +55,7 @@ class CommitGroup(enum.Enum): 'dependencies', 'jsinterp', 'outtmpl', + 'formats', 'plugins', 'update', 'upstream', @@ -68,9 +69,9 @@ class CommitGroup(enum.Enum): 'misc', 'test', }, - cls.EXTRACTOR: {'extractor'}, - cls.DOWNLOADER: {'downloader'}, - cls.POSTPROCESSOR: {'postprocessor'}, + cls.EXTRACTOR: {'extractor', 'ie'}, + cls.DOWNLOADER: {'downloader', 'fd'}, + cls.POSTPROCESSOR: {'postprocessor', 'pp'}, }.items() for name in names } diff --git a/setup.cfg b/setup.cfg index 68d9e516d..6deaa7971 100644 --- a/setup.cfg +++ b/setup.cfg @@ -8,7 +8,6 @@ ignore = E402,E501,E731,E741,W503 max_line_length = 120 per_file_ignores = devscripts/lazy_load_template.py: F401 - yt_dlp/utils/__init__.py: F401, F403 [autoflake] diff --git a/yt_dlp/YoutubeDL.py b/yt_dlp/YoutubeDL.py index d4aff0743..448a15bc9 100644 --- a/yt_dlp/YoutubeDL.py +++ b/yt_dlp/YoutubeDL.py @@ -3687,7 +3687,7 @@ class YoutubeDL: def simplified_codec(f, field): assert field in ('acodec', 'vcodec') - codec = f.get(field, 'unknown') + codec = f.get(field) if not codec: return 'unknown' elif codec != 'none': diff --git a/yt_dlp/downloader/common.py b/yt_dlp/downloader/common.py index a0219a350..8fe9d9993 100644 --- a/yt_dlp/downloader/common.py +++ b/yt_dlp/downloader/common.py @@ -255,7 +255,8 @@ class FileDownloader: @wrap_file_access('remove') def try_remove(self, filename): - os.remove(filename) + if os.path.isfile(filename): + os.remove(filename) @wrap_file_access('rename') def try_rename(self, old_filename, new_filename): diff --git a/yt_dlp/downloader/fragment.py b/yt_dlp/downloader/fragment.py index 458167216..069815326 100644 --- a/yt_dlp/downloader/fragment.py +++ b/yt_dlp/downloader/fragment.py @@ -300,9 +300,7 @@ class FragmentFD(FileDownloader): def _finish_frag_download(self, ctx, info_dict): ctx['dest_stream'].close() if self.__do_ytdl_file(ctx): - ytdl_filename = encodeFilename(self.ytdl_filename(ctx['filename'])) - if os.path.isfile(ytdl_filename): - self.try_remove(ytdl_filename) + self.try_remove(self.ytdl_filename(ctx['filename'])) elapsed = time.time() - ctx['started'] to_file = ctx['tmpfilename'] != '-' diff --git a/yt_dlp/extractor/adobepass.py b/yt_dlp/extractor/adobepass.py index 68a970f68..722a534ed 100644 --- a/yt_dlp/extractor/adobepass.py +++ b/yt_dlp/extractor/adobepass.py @@ -1473,7 +1473,7 @@ class AdobePassIE(InfoExtractor): # XXX: Conventionally, base classes should en elif 'automatically signed in with' in provider_redirect_page: # Seems like comcast is rolling up new way of automatically signing customers oauth_redirect_url = self._html_search_regex( - r'continue:\s*"(https://oauth.xfinity.com/oauth/authorize\?.+)"', provider_redirect_page, + r'continue:\s*"(https://oauth\.xfinity\.com/oauth/authorize\?.+)"', provider_redirect_page, 'oauth redirect (signed)') # Just need to process the request. No useful data comes back self._download_webpage(oauth_redirect_url, video_id, 'Confirming auto login') diff --git a/yt_dlp/extractor/iqiyi.py b/yt_dlp/extractor/iqiyi.py index ebf49e835..fa602ba88 100644 --- a/yt_dlp/extractor/iqiyi.py +++ b/yt_dlp/extractor/iqiyi.py @@ -527,7 +527,7 @@ class IqIE(InfoExtractor): if player_js_cache: return player_js_cache webpack_js_url = self._proto_relative_url(self._search_regex( - r'