1
0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-11-14 11:07:50 +01:00

Correct configuration file locations

This commit is contained in:
Philipp Hagemeister 2013-12-03 13:09:48 +01:00
parent 1b753cb334
commit fb27c2295e
2 changed files with 14 additions and 6 deletions

View File

@ -183,7 +183,7 @@ which means you can modify it, redistribute it or use it however you like.
# CONFIGURATION # CONFIGURATION
You can configure youtube-dl by placing default arguments (such as `--extract-audio --no-mtime` to always extract the audio and not copy the mtime) into `/etc/youtube-dl.conf` and/or `~/.config/youtube-dl.conf`. On Windows, the configuration file locations are `%APPDATA%\youtube-dl\config` and `C:\Users\<Yourname>\youtube-dl.conf`. You can configure youtube-dl by placing default arguments (such as `--extract-audio --no-mtime` to always extract the audio and not copy the mtime) into `/etc/youtube-dl.conf` and/or `~/.config/youtube-dl.conf`. On Windows, the configuration file locations are `%APPDATA%\youtube-dl\config.txt` and `C:\Users\<Yourname>\youtube-dl.conf`.
# OUTPUT TEMPLATE # OUTPUT TEMPLATE

View File

@ -81,11 +81,11 @@ from .PostProcessor import (
def parseOpts(overrideArguments=None): def parseOpts(overrideArguments=None):
def _readOptions(filename_bytes, def=[]): def _readOptions(filename_bytes, default=[]):
try: try:
optionf = open(filename_bytes) optionf = open(filename_bytes)
except IOError: except IOError:
return def # silently skip if file is not present return default # silently skip if file is not present
try: try:
res = [shlex.split(l, comments=True) for l in optionf] res = [shlex.split(l, comments=True) for l in optionf]
finally: finally:
@ -435,12 +435,20 @@ def parseOpts(overrideArguments=None):
if appdata_dir: if appdata_dir:
userConf = _readOptions( userConf = _readOptions(
os.path.join(appdata_dir, 'youtube-dl', 'config'), os.path.join(appdata_dir, 'youtube-dl', 'config'),
def=None) default=None)
if userConf is None:
userConf = _readOptions(
os.path.join(appdata_dir, 'youtube-dl', 'config.txt'),
default=None)
if userConf is None: if userConf is None:
userConfFile = _readOptions( userConf = _readOptions(
os.path.join(os.path.expanduser('~'), 'youtube-dl.conf'), os.path.join(os.path.expanduser('~'), 'youtube-dl.conf'),
def=None) default=None)
if userConf is None:
userConf = _readOptions(
os.path.join(os.path.expanduser('~'), 'youtube-dl.conf.txt'),
default=None)
if userConf is None: if userConf is None:
userConf = [] userConf = []