New plex implementation

This commit is contained in:
Johan Hjorth 2025-06-25 15:03:26 +02:00
parent bd5b3538c8
commit 56e1061325
6 changed files with 121 additions and 6 deletions

View file

@ -1,3 +1,4 @@
#musicbrainz_helpers.py
import json
from pathlib import Path
@ -7,12 +8,16 @@ def load_cache():
try:
if not CACHE_FILE.exists():
with open(CACHE_FILE, "w") as f:
json.dump({"added_artists": [], "similar_cache": {}}, f)
json.dump({
"added_artists": [],
"similar_cache": {},
"added_tracks": []
}, 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)
return {
"added_artists": [],
"similar_cache": {},
"added_tracks": []
}