discoverylidarr/musicbrainz_helpers.py

24 lines
621 B
Python
Raw Normal View History

2025-06-25 15:03:26 +02:00
#musicbrainz_helpers.py
2025-06-23 10:31:25 +02:00
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:
2025-06-25 15:03:26 +02:00
json.dump({
"added_artists": [],
"similar_cache": {},
"added_tracks": []
}, f)
2025-06-23 10:31:25 +02:00
with open(CACHE_FILE, "r") as f:
return json.load(f)
except Exception:
2025-06-25 15:03:26 +02:00
return {
"added_artists": [],
"similar_cache": {},
"added_tracks": []
}