Various Fixes
This commit is contained in:
@@ -3,7 +3,7 @@ import sys
|
|||||||
from pathlib import Path, PurePath
|
from pathlib import Path, PurePath
|
||||||
from typing import Any
|
from typing import Any
|
||||||
|
|
||||||
ZOTIFY_VERSION = "0.2.4"
|
ZOTIFY_VERSION = "0.2.5"
|
||||||
ROOT_PATH = 'ROOT_PATH'
|
ROOT_PATH = 'ROOT_PATH'
|
||||||
ROOT_PODCAST_PATH = 'ROOT_PODCAST_PATH'
|
ROOT_PODCAST_PATH = 'ROOT_PODCAST_PATH'
|
||||||
SKIP_EXISTING = 'SKIP_EXISTING'
|
SKIP_EXISTING = 'SKIP_EXISTING'
|
||||||
@@ -286,11 +286,11 @@ class Config:
|
|||||||
if cls.get(CREDENTIALS_LOCATION) == '':
|
if cls.get(CREDENTIALS_LOCATION) == '':
|
||||||
system_paths = {
|
system_paths = {
|
||||||
'win32': Path.home() / 'AppData/Roaming/Zotify',
|
'win32': Path.home() / 'AppData/Roaming/Zotify',
|
||||||
'linux': Path.home() / '.local/share/zotify',
|
'linux': Path.home() / '.config/zotify',
|
||||||
'darwin': Path.home() / 'Library/Application Support/Zotify'
|
'darwin': Path.home() / 'Library/Application Support/Zotify'
|
||||||
}
|
}
|
||||||
if sys.platform not in system_paths:
|
if sys.platform not in system_paths:
|
||||||
credentials_location = PurePath(Path.cwd() / '.zotify/credentials.json')
|
credentials_location = PurePath(Path.cwd() / '.config/credentials.json')
|
||||||
else:
|
else:
|
||||||
credentials_location = PurePath(system_paths[sys.platform] / 'credentials.json')
|
credentials_location = PurePath(system_paths[sys.platform] / 'credentials.json')
|
||||||
else:
|
else:
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
from pathlib import Path, PurePath
|
from pathlib import Path, PurePath
|
||||||
from typing import Any, Tuple, List, Optional, Literal
|
from typing import Any, Tuple, List, Optional, Literal
|
||||||
|
|
||||||
|
import os
|
||||||
import json
|
import json
|
||||||
import math
|
import math
|
||||||
import re
|
import re
|
||||||
@@ -50,21 +51,13 @@ def get_followed_artists() -> list:
|
|||||||
|
|
||||||
|
|
||||||
def ensure_spoticlub_credentials() -> None:
|
def ensure_spoticlub_credentials() -> None:
|
||||||
"""Ensure SpotiClub credentials JSON exists and is populated.
|
if os.name == 'nt':
|
||||||
|
appdata = os.environ.get('APPDATA')
|
||||||
The file is created (or updated) in the same base config directory as other
|
cred_path = Path(appdata) / 'Zotify' if appdata else (Path.home() / 'AppData' / 'Roaming' / 'Zotify')
|
||||||
Zotify files, with this structure:
|
else:
|
||||||
|
xdg_config_home = os.environ.get('XDG_CONFIG_HOME')
|
||||||
{
|
base = Path(xdg_config_home) if xdg_config_home else (Path.home() / '.config')
|
||||||
"server_url": "http://api.spoticlub.zip:4277/get_audio_key",
|
cred_path = base / 'zotify'
|
||||||
"spoticlub_user": "...",
|
|
||||||
"spoticlub_password": "..."
|
|
||||||
}
|
|
||||||
|
|
||||||
If the file is missing or missing any required values, prompt the user once
|
|
||||||
via stdin before any download starts.
|
|
||||||
"""
|
|
||||||
cred_path = Path.home() / 'AppData\\Roaming\\Zotify'
|
|
||||||
cred_path.mkdir(parents=True, exist_ok=True)
|
cred_path.mkdir(parents=True, exist_ok=True)
|
||||||
|
|
||||||
creds_file = cred_path / 'spoticlub_credentials.json'
|
creds_file = cred_path / 'spoticlub_credentials.json'
|
||||||
|
|||||||
Reference in New Issue
Block a user