mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-30 07:28:19 +01:00
[cleanup] Refactor __init__.py
(#2570)
* Split `__init__` code into multiple functions * Clean up validation code by grouping similar types of options * Expose `parse_options` to third parties
This commit is contained in:
parent
1eae7f94c1
commit
d1b5f70bc9
File diff suppressed because it is too large
Load Diff
|
@ -1182,7 +1182,7 @@ def _dict_from_options_callback(
|
||||||
help='Do not write video description (default)')
|
help='Do not write video description (default)')
|
||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
'--write-info-json',
|
'--write-info-json',
|
||||||
action='store_true', dest='writeinfojson', default=False,
|
action='store_true', dest='writeinfojson', default=None,
|
||||||
help='Write video metadata to a .info.json file (this may contain personal information)')
|
help='Write video metadata to a .info.json file (this may contain personal information)')
|
||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
'--no-write-info-json',
|
'--no-write-info-json',
|
||||||
|
|
|
@ -404,7 +404,7 @@ def _concat_spec(cls, in_files, concat_opts=None):
|
||||||
|
|
||||||
class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
class FFmpegExtractAudioPP(FFmpegPostProcessor):
|
||||||
COMMON_AUDIO_EXTS = ('wav', 'flac', 'm4a', 'aiff', 'mp3', 'ogg', 'mka', 'opus', 'wma')
|
COMMON_AUDIO_EXTS = ('wav', 'flac', 'm4a', 'aiff', 'mp3', 'ogg', 'mka', 'opus', 'wma')
|
||||||
SUPPORTED_EXTS = ('best', 'aac', 'flac', 'mp3', 'm4a', 'opus', 'vorbis', 'wav', 'alac')
|
SUPPORTED_EXTS = ('aac', 'flac', 'mp3', 'm4a', 'opus', 'vorbis', 'wav', 'alac')
|
||||||
|
|
||||||
def __init__(self, downloader=None, preferredcodec=None, preferredquality=None, nopostoverwrites=False):
|
def __init__(self, downloader=None, preferredcodec=None, preferredquality=None, nopostoverwrites=False):
|
||||||
FFmpegPostProcessor.__init__(self, downloader)
|
FFmpegPostProcessor.__init__(self, downloader)
|
||||||
|
|
|
@ -3603,6 +3603,9 @@ def match_str(filter_str, dct, incomplete=False):
|
||||||
|
|
||||||
|
|
||||||
def match_filter_func(filter_str):
|
def match_filter_func(filter_str):
|
||||||
|
if filter_str is None:
|
||||||
|
return None
|
||||||
|
|
||||||
def _match_func(info_dict, *args, **kwargs):
|
def _match_func(info_dict, *args, **kwargs):
|
||||||
if match_str(filter_str, info_dict, *args, **kwargs):
|
if match_str(filter_str, info_dict, *args, **kwargs):
|
||||||
return None
|
return None
|
||||||
|
|
Loading…
Reference in New Issue
Block a user