[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
4 changed files with 486 additions and 467 deletions
File diff suppressed because it is too large
Load diff
|
@ -1182,7 +1182,7 @@ def create_parser():
|
||||||
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 @@ class FFmpegPostProcessor(PostProcessor):
|
||||||
|
|
||||||
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 a new issue