From: Philipp Hagemeister Date: Tue, 3 Dec 2013 12:09:48 +0000 (+0100) Subject: Correct configuration file locations X-Git-Url: http://git.bitcoin.ninja/index.cgi?a=commitdiff_plain;h=fb27c2295e0e9d6f2f6ac45ed5906987b4710d0a;p=youtube-dl Correct configuration file locations --- diff --git a/README.md b/README.md index 0ff6ff8b9..85af7cf7e 100644 --- a/README.md +++ b/README.md @@ -183,7 +183,7 @@ which means you can modify it, redistribute it or use it however you like. # 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\\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\\youtube-dl.conf`. # OUTPUT TEMPLATE diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py index 32490b24e..9c8a694f0 100644 --- a/youtube_dl/__init__.py +++ b/youtube_dl/__init__.py @@ -81,11 +81,11 @@ from .PostProcessor import ( def parseOpts(overrideArguments=None): - def _readOptions(filename_bytes, def=[]): + def _readOptions(filename_bytes, default=[]): try: optionf = open(filename_bytes) except IOError: - return def # silently skip if file is not present + return default # silently skip if file is not present try: res = [shlex.split(l, comments=True) for l in optionf] finally: @@ -435,12 +435,20 @@ def parseOpts(overrideArguments=None): if appdata_dir: userConf = _readOptions( 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: - userConfFile = _readOptions( + userConf = _readOptions( 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: userConf = []