summaryrefslogtreecommitdiffhomepage
path: root/youtube_dl/__init__.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <[email protected]>2013-10-02 08:23:53 +0200
committerPhilipp Hagemeister <[email protected]>2013-10-02 08:23:53 +0200
commit4f8bf17f23e2366205d8670fc9af2568063f7e89 (patch)
tree0cd76f061d93cdca164bb9b102a6a039f37c594f /youtube_dl/__init__.py
parentca40186c75d93250f9115328838703b021f21c8a (diff)
parentfa556755930db77c62016a468d870e76608db012 (diff)
downloadyoutube-dl-4f8bf17f23e2366205d8670fc9af2568063f7e89.tar.gz
youtube-dl-4f8bf17f23e2366205d8670fc9af2568063f7e89.zip
Merge remote-tracking branch 'holomorph/master'
Diffstat (limited to 'youtube_dl/__init__.py')
-rw-r--r--youtube_dl/__init__.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/youtube_dl/__init__.py b/youtube_dl/__init__.py
index c9e75eab4..cc771ee89 100644
--- a/youtube_dl/__init__.py
+++ b/youtube_dl/__init__.py
@@ -113,6 +113,12 @@ def parseOpts(overrideArguments=None):
pass
return opts
+ xdg_cache_home = os.environ.get('XDG_CACHE_HOME')
+ if xdg_cache_home:
+ userCacheDir = os.path.join(xdg_cache_home, 'youtube-dl')
+ else:
+ userCacheDir = os.path.join(os.path.expanduser('~'), '.cache', 'youtube-dl')
+
max_width = 80
max_help_position = 80
@@ -168,7 +174,7 @@ def parseOpts(overrideArguments=None):
general.add_option('--proxy', dest='proxy', default=None, help='Use the specified HTTP/HTTPS proxy', metavar='URL')
general.add_option('--no-check-certificate', action='store_true', dest='no_check_certificate', default=False, help='Suppress HTTPS certificate validation.')
general.add_option(
- '--cache-dir', dest='cachedir', default=u'~/.youtube-dl/cache',
+ '--cache-dir', dest='cachedir', default=userCacheDir,
help='Location in the filesystem where youtube-dl can store downloaded information permanently. %default by default')
general.add_option(
'--no-cache-dir', action='store_const', const=None, dest='cachedir',
@@ -370,9 +376,13 @@ def parseOpts(overrideArguments=None):
else:
xdg_config_home = os.environ.get('XDG_CONFIG_HOME')
if xdg_config_home:
- userConfFile = os.path.join(xdg_config_home, 'youtube-dl.conf')
+ userConfFile = os.path.join(xdg_config_home, 'youtube-dl', 'config')
+ if not os.path.isfile(userConfFile):
+ userConfFile = os.path.join(xdg_config_home, 'youtube-dl.conf')
else:
- userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl.conf')
+ userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl', 'config')
+ if not os.path.isfile(userConfFile):
+ userConfFile = os.path.join(os.path.expanduser('~'), '.config', 'youtube-dl.conf')
systemConf = _readOptions('/etc/youtube-dl.conf')
userConf = _readOptions(userConfFile)
commandLineConf = sys.argv[1:]