Iniital Commit

This commit is contained in:
Johan Hjorth 2025-06-23 10:31:25 +02:00
parent 91245007e6
commit f20aa9b0d8
6 changed files with 168 additions and 1 deletions

18
musicbrainz_helpers.py Normal file
View file

@ -0,0 +1,18 @@
import json
from pathlib import Path
CACHE_FILE = Path(__file__).resolve().parent / "cache.json"
def load_cache():
try:
if not CACHE_FILE.exists():
with open(CACHE_FILE, "w") as f:
json.dump({"added_artists": [], "similar_cache": {}}, f)
with open(CACHE_FILE, "r") as f:
return json.load(f)
except Exception:
return {"added_artists": [], "similar_cache": {}}
def save_cache(cache):
with open(CACHE_FILE, "w") as f:
json.dump(cache, f, indent=2)