-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathconst.py
31 lines (29 loc) · 1.31 KB
/
const.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#!/usr/bin/env python
# encoding: UTF-8
import os
class Constant(object):
if "XDG_CONFIG_HOME" in os.environ:
conf_dir = os.path.join(os.environ["XDG_CONFIG_HOME"], "music-storage")
else:
conf_dir = os.path.join(os.path.expanduser("~"), ".music-storage")
config_path = os.path.join(conf_dir, "config.json")
if "XDG_CACHE_HOME" in os.environ:
cacheDir = os.path.join(os.environ["XDG_CACHE_HOME"], "music-storage")
if not os.path.exists(cacheDir):
os.mkdir(cacheDir)
download_dir = os.path.join(cacheDir, "cached")
cache_path = os.path.join(cacheDir, "nemcache")
else:
download_dir = os.path.join(conf_dir, "cached")
cache_path = os.path.join(conf_dir, "nemcache")
if "XDG_DATA_HOME" in os.environ:
dataDir = os.path.join(os.environ["XDG_DATA_HOME"], "music-storage")
if not os.path.exists(dataDir):
os.mkdir(dataDir)
cookie_path = os.path.join(dataDir, "cookie")
log_path = os.path.join(dataDir, "musicstorage.log")
storage_path = os.path.join(dataDir, "database.json")
else:
cookie_path = os.path.join(conf_dir, "cookie")
log_path = os.path.join(conf_dir, "musicstorage.log")
storage_path = os.path.join(conf_dir, "database.json")