aboutsummaryrefslogtreecommitdiffstats
path: root/yt_dlp/utils.py
diff options
context:
space:
mode:
authorpukkandan <pukkandan.ytdlp@gmail.com>2022-05-24 17:30:28 +0530
committerpukkandan <pukkandan.ytdlp@gmail.com>2022-05-27 04:32:54 +0530
commit6b9e832db7dedcd6f2e7be1bf44f56a91ff18737 (patch)
treec699c647ca5ab5e54d0678d2c136da37960bc3a2 /yt_dlp/utils.py
parentd2ff2c91bbac42e4d84131d7cf23d79c910d5309 (diff)
downloadhypervideo-pre-6b9e832db7dedcd6f2e7be1bf44f56a91ff18737.tar.lz
hypervideo-pre-6b9e832db7dedcd6f2e7be1bf44f56a91ff18737.tar.xz
hypervideo-pre-6b9e832db7dedcd6f2e7be1bf44f56a91ff18737.zip
`--config-location -` to provide options interactively
Diffstat (limited to 'yt_dlp/utils.py')
-rw-r--r--yt_dlp/utils.py9
1 files changed, 9 insertions, 0 deletions
diff --git a/yt_dlp/utils.py b/yt_dlp/utils.py
index 2e3c51562..6701492f2 100644
--- a/yt_dlp/utils.py
+++ b/yt_dlp/utils.py
@@ -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')