Various Fixes

This commit is contained in:
unknown
2025-12-20 01:55:11 +01:00
parent f31f6575fa
commit aea1dc23a6
2 changed files with 11 additions and 18 deletions

View File

@@ -3,7 +3,7 @@ import sys
from pathlib import Path, PurePath
from typing import Any
ZOTIFY_VERSION = "0.2.4"
ZOTIFY_VERSION = "0.2.5"
ROOT_PATH = 'ROOT_PATH'
ROOT_PODCAST_PATH = 'ROOT_PODCAST_PATH'
SKIP_EXISTING = 'SKIP_EXISTING'
@@ -286,11 +286,11 @@ class Config:
if cls.get(CREDENTIALS_LOCATION) == '':
system_paths = {
'win32': Path.home() / 'AppData/Roaming/Zotify',
'linux': Path.home() / '.local/share/zotify',
'linux': Path.home() / '.config/zotify',
'darwin': Path.home() / 'Library/Application Support/Zotify'
}
if sys.platform not in system_paths:
credentials_location = PurePath(Path.cwd() / '.zotify/credentials.json')
credentials_location = PurePath(Path.cwd() / '.config/credentials.json')
else:
credentials_location = PurePath(system_paths[sys.platform] / 'credentials.json')
else:

View File

@@ -1,6 +1,7 @@
from pathlib import Path, PurePath
from typing import Any, Tuple, List, Optional, Literal
import os
import json
import math
import re
@@ -50,21 +51,13 @@ def get_followed_artists() -> list:
def ensure_spoticlub_credentials() -> None:
"""Ensure SpotiClub credentials JSON exists and is populated.
The file is created (or updated) in the same base config directory as other
Zotify files, with this structure:
{
"server_url": "http://api.spoticlub.zip:4277/get_audio_key",
"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'
if os.name == 'nt':
appdata = os.environ.get('APPDATA')
cred_path = Path(appdata) / 'Zotify' if appdata else (Path.home() / 'AppData' / 'Roaming' / 'Zotify')
else:
xdg_config_home = os.environ.get('XDG_CONFIG_HOME')
base = Path(xdg_config_home) if xdg_config_home else (Path.home() / '.config')
cred_path = base / 'zotify'
cred_path.mkdir(parents=True, exist_ok=True)
creds_file = cred_path / 'spoticlub_credentials.json'