|
|
@ -11,6 +11,7 @@ from .compat import (
|
|
|
|
compat_get_terminal_size,
|
|
|
|
compat_get_terminal_size,
|
|
|
|
compat_getenv,
|
|
|
|
compat_getenv,
|
|
|
|
compat_kwargs,
|
|
|
|
compat_kwargs,
|
|
|
|
|
|
|
|
compat_open as open,
|
|
|
|
compat_shlex_split,
|
|
|
|
compat_shlex_split,
|
|
|
|
)
|
|
|
|
)
|
|
|
|
from .utils import (
|
|
|
|
from .utils import (
|
|
|
@ -41,14 +42,11 @@ def _hide_login_info(opts):
|
|
|
|
def parseOpts(overrideArguments=None):
|
|
|
|
def parseOpts(overrideArguments=None):
|
|
|
|
def _readOptions(filename_bytes, default=[]):
|
|
|
|
def _readOptions(filename_bytes, default=[]):
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
optionf = open(filename_bytes)
|
|
|
|
optionf = open(filename_bytes, encoding=preferredencoding())
|
|
|
|
except IOError:
|
|
|
|
except IOError:
|
|
|
|
return default # silently skip if file is not present
|
|
|
|
return default # silently skip if file is not present
|
|
|
|
try:
|
|
|
|
try:
|
|
|
|
# FIXME: https://github.com/ytdl-org/youtube-dl/commit/dfe5fa49aed02cf36ba9f743b11b0903554b5e56
|
|
|
|
|
|
|
|
contents = optionf.read()
|
|
|
|
contents = optionf.read()
|
|
|
|
if sys.version_info < (3,):
|
|
|
|
|
|
|
|
contents = contents.decode(preferredencoding())
|
|
|
|
|
|
|
|
res = compat_shlex_split(contents, comments=True)
|
|
|
|
res = compat_shlex_split(contents, comments=True)
|
|
|
|
finally:
|
|
|
|
finally:
|
|
|
|
optionf.close()
|
|
|
|
optionf.close()
|
|
|
|