Catch key exception + correct typo + fix path interpolation
This commit is contained in:
parent
ebae24e865
commit
97bf0b4eb4
@ -40,11 +40,11 @@ LYRICS_LOGGER = logging.getLogger("lyrics")
|
|||||||
GENIUS_LOGGER = logging.getLogger("genius")
|
GENIUS_LOGGER = logging.getLogger("genius")
|
||||||
|
|
||||||
NOT_A_GENRE = ".", "..", "misc_scripts", "Music", "script", ".git", ".idea"
|
NOT_A_GENRE = ".", "..", "misc_scripts", "Music", "script", ".git", ".idea"
|
||||||
MUSIC_DIR = os.path.join("~", ".config", "user-dirs.dirs")
|
MUSIC_DIR = os.path.join(os.path.expanduser("~"), "Music")
|
||||||
|
|
||||||
if current_os == "linux":
|
if current_os == "linux":
|
||||||
# XDG_USER_DIRS_FILE reference: https://freedesktop.org/wiki/Software/xdg-user-dirs/
|
# XDG_USER_DIRS_FILE reference: https://freedesktop.org/wiki/Software/xdg-user-dirs/
|
||||||
XDG_USER_DIRS_FILE = os.path.expanduser("~/.config/user-dirs.dirs")
|
XDG_USER_DIRS_FILE = os.path.join(os.path.expanduser("~"), ".config", "user-dirs.dirs")
|
||||||
logger = logging.getLogger("init_path")
|
logger = logging.getLogger("init_path")
|
||||||
logger.setLevel(logging.WARNING)
|
logger.setLevel(logging.WARNING)
|
||||||
try:
|
try:
|
||||||
@ -56,11 +56,10 @@ if current_os == "linux":
|
|||||||
MUSIC_DIR = os.path.expandvars(xdg_config['xdg_music_dir'].strip('"'))
|
MUSIC_DIR = os.path.expandvars(xdg_config['xdg_music_dir'].strip('"'))
|
||||||
except (FileNotFoundError, KeyError) as E:
|
except (FileNotFoundError, KeyError) as E:
|
||||||
logger.warning(f'''
|
logger.warning(f'''
|
||||||
Missing file or key at: '{XDG_USER_DIRS_FILE}'.
|
Missing file or No entry found for "xdg_music_dir" in: \'{XDG_USER_DIRS_FILE}\'.
|
||||||
Will fallback on default '$HOME/Music'.
|
Will fallback on default '$HOME/Music'.
|
||||||
----
|
----
|
||||||
''')
|
''')
|
||||||
|
|
||||||
TOR = False
|
TOR = False
|
||||||
proxies = {
|
proxies = {
|
||||||
'http': 'socks5h://127.0.0.1:9150',
|
'http': 'socks5h://127.0.0.1:9150',
|
||||||
|
Loading…
Reference in New Issue
Block a user