aboutsummaryrefslogtreecommitdiff
path: root/youtube_dl/utils.py
diff options
context:
space:
mode:
authorPhilipp Hagemeister <phihag@phihag.de>2013-10-02 08:41:03 +0200
committerPhilipp Hagemeister <phihag@phihag.de>2013-10-02 08:41:14 +0200
commitc38b1e776dcc525b6fbe0660c484f1d50d2e0165 (patch)
treeb956c4d52962f9d6702ad906c1ff465b8ba52fde /youtube_dl/utils.py
parent4f8bf17f23e2366205d8670fc9af2568063f7e89 (diff)
[youtube] Simplify cache_dir code (#1529)
Diffstat (limited to 'youtube_dl/utils.py')
-rw-r--r--youtube_dl/utils.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/youtube_dl/utils.py b/youtube_dl/utils.py
index 201ed255d..f5f9cde99 100644
--- a/youtube_dl/utils.py
+++ b/youtube_dl/utils.py
@@ -824,3 +824,9 @@ def intlist_to_bytes(xs):
return ''.join([chr(x) for x in xs])
else:
return bytes(xs)
+
+
+def get_cachedir(params={}):
+ cache_root = os.environ.get('XDG_CACHE_HOME',
+ os.path.expanduser('~/.cache'))
+ return params.get('cachedir', os.path.join(cache_root, 'youtube-dl'))