[youtube] Simplify cache_dir code (#1529)

This commit is contained in:
Philipp Hagemeister 2013-10-02 08:41:03 +02:00
parent 4f8bf17f23
commit c38b1e776d
3 changed files with 9 additions and 13 deletions

View file

@ -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'))