1
0
mirror of https://github.com/yt-dlp/yt-dlp synced 2025-07-04 04:52:52 -05:00

--config-location - to provide options interactively

This commit is contained in:
pukkandan
2022-05-24 17:30:28 +05:30
parent d2ff2c91bb
commit 6b9e832db7
4 changed files with 19 additions and 13 deletions

View File

@ -5163,6 +5163,12 @@ def parse_http_range(range):
return int(crg.group(1)), int_or_none(crg.group(2)), int_or_none(crg.group(3))
def read_stdin(what):
eof = 'Ctrl+Z' if compat_os_name == 'nt' else 'Ctrl+D'
write_string(f'Reading {what} from STDIN - EOF ({eof}) to end:\n')
return sys.stdin
class Config:
own_args = None
parsed_args = None
@ -5188,6 +5194,9 @@ class Config:
self.parsed_args, self.filename = args, filename
for location in opts.config_locations or []:
if location == '-':
self.append_config(shlex.split(read_stdin('options'), comments=True), label='stdin')
continue
location = os.path.join(directory, expand_path(location))
if os.path.isdir(location):
location = os.path.join(location, 'yt-dlp.conf')