From c38b1e776dcc525b6fbe0660c484f1d50d2e0165 Mon Sep 17 00:00:00 2001 From: Philipp Hagemeister Date: Wed, 2 Oct 2013 08:41:03 +0200 Subject: [youtube] Simplify cache_dir code (#1529) --- youtube_dl/utils.py | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'youtube_dl/utils.py') 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')) -- cgit v1.2.3