Files
stemify/stemroller/player/config.py
T
ClericalErrorandClaude Opus 5.5 1845f03c41 StemRoller: desktop stem separator, Android stems player, and server daemons
- stemroller/: PySide6/QML desktop app and player for separating music into stems
- android/: Plex music player that plays per-stem mixes, with Android Auto support,
  a graphic + parametric (Equalizer APO-style) EQ, and offline downloads
- server/: stemserve (serves stems to the app) and stemd (separates the library on
  the server's GPU, with "Stem Now" priority requests)

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-14 21:17:17 -07:00

48 lines
1.3 KiB
Python

"""Player settings and saved state: ~/.config/stemroller/player.json."""
import json
import os
import uuid
CONFIG_DIR = os.path.join(os.environ.get("XDG_CONFIG_HOME", os.path.expanduser("~/.config")), "stemroller")
CACHE_DIR = os.path.join(os.environ.get("XDG_CACHE_HOME", os.path.expanduser("~/.cache")), "stemroller", "player")
PATH = os.path.join(CONFIG_DIR, "player.json")
DEFAULTS = {
"plexUrl": "http://192.168.86.2:32400",
"plexToken": "",
"plexUser": "",
"musicSection": "",
"sectionLocations": [],
"stemUrl": "http://192.168.86.2:8765",
"stemToken": "",
# The unraid shares, mounted here; files play straight from them when present.
"stemsDir": "/var/mnt/unraid/Music/Stems",
"musicDir": "/var/mnt/unraid/Music/Actual music/Flacs",
"stemRoots": [],
"volume": 0.8,
"keepMix": False,
"showMixer": True,
"gridlines": True,
"zoom": 100,
}
def load() -> dict:
cfg = dict(DEFAULTS)
try:
with open(PATH) as f:
cfg.update(json.load(f))
except (OSError, ValueError):
pass
cfg.setdefault("clientId", str(uuid.uuid4()))
return cfg
def save(cfg: dict):
os.makedirs(CONFIG_DIR, exist_ok=True)
tmp = PATH + ".tmp"
with open(tmp, "w") as f:
json.dump(cfg, f, indent=1)
os.replace(tmp, PATH)