Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

提交变更 #846

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added .DS_Store
Binary file not shown.
58 changes: 58 additions & 0 deletions NEMbox/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,64 @@ def __init__(self):
"default": False,
"describe": "Set true to make curses transparency.",
},
"colors": {
"value": {
"pair1":[22,148],
"pair2":[231,24],
"pair3":[231,9],
"pair4":[231,14],
"pair5":[231, 237]
},
"default":{
"pair1":[22,148],
"pair2":[231,24],
"pair3":[231,9],
"pair4":[231,14],
"pair5":[231, 237]
},
"describe": "xterm-256color theme.",
},
"keymap":{
"value": {
"down":"j",
"up":"k",
"back":"h",
"forward":"l",
"prevPage":"^B",
"nextPage":"^F",
"search":"/",
"prevSong":"p",
"nextSong":"n",
"playPause":" ",
"shuffle":"?",
"volume+":"+",
"volume-":"-",
"menu":"m",
"presentHistory":"h",
"musicInfo":"i",
"playingMode":"P",
"enterAlbum":"A",
"add":"a",
"djList":"z",
"star":"s",
"collection":"c",
"remove":"r",
"moveDown":"J",
"moveUp":"K",
"like":",",
"cache":"C",
"trashFM":".",
"nextFM":"f",
"quit":"q",
"quitClear":"w",
"help":"y",
"top":"g",
"bottom":"G",
"countDown":"t"

},
"describe": "Keys and function."
}
}
self.config = {}
if not os.path.isfile(self.path):
Expand Down
31 changes: 25 additions & 6 deletions NEMbox/const.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,32 @@
# encoding: UTF-8
# KenHuang: 使配置文件夹符合XDG标准
from __future__ import print_function, unicode_literals, division, absolute_import
import os


class Constant(object):
conf_dir = os.path.join(os.path.expanduser("~"), ".netease-musicbox")
download_dir = os.path.join(conf_dir, "cached")
if "XDG_CONFIG_HOME" in os.environ:
conf_dir = os.path.join(os.environ["XDG_CONFIG_HOME"], "netease-musicbox")
else:
conf_dir = os.path.join(os.path.expanduser("~"), ".netease-musicbox")
config_path = os.path.join(conf_dir, "config.json")
storage_path = os.path.join(conf_dir, "database.json")
cookie_path = os.path.join(conf_dir, "cookie")
log_path = os.path.join(conf_dir, "musicbox.log")
cache_path = os.path.join(conf_dir, "nemcache")
if "XDG_CACHE_HOME" in os.environ:
cacheDir = os.path.join(os.environ["XDG_CACHE_HOME"], "netease-musicbox")
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"], "netease-musicbox")
if not os.path.exists(dataDir):
os.mkdir(dataDir)
cookie_path = os.path.join(dataDir, "cookie")
log_path = os.path.join(dataDir, "musicbox.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, "musicbox.log")
storage_path = os.path.join(conf_dir, "database.json")
Loading