non-working solution
This commit is contained in:
parent
56e1061325
commit
b9a288461e
2 changed files with 16 additions and 1 deletions
|
|
@ -4,9 +4,15 @@ from musicbrainz_helpers import load_cache
|
|||
import time
|
||||
|
||||
def main():
|
||||
print("Startar spellistgenerator")
|
||||
cache = load_cache()
|
||||
added_artists = cache.get("added_artists", [])
|
||||
added_tracks = cache.get("added_tracks", [])
|
||||
|
||||
print(f"📦 Antal artists i cache: {len(added_artists)}")
|
||||
if not added_artists:
|
||||
print("[PLEX] Ingen artist har lagts till ännu.")
|
||||
return
|
||||
|
||||
if not added_artists:
|
||||
print("[PLEX] Ingen artist har lagts till ännu.")
|
||||
|
|
|
|||
|
|
@ -14,10 +14,19 @@ def load_cache():
|
|||
"added_tracks": []
|
||||
}, f)
|
||||
with open(CACHE_FILE, "r") as f:
|
||||
return json.load(f)
|
||||
data = json.load(f)
|
||||
data.setdefault("added_artists", [])
|
||||
data.setdefault("similar_cache", {})
|
||||
data.setdefault("added_tracks", [])
|
||||
return data
|
||||
except Exception:
|
||||
return {
|
||||
"added_artists": [],
|
||||
"similar_cache": {},
|
||||
"added_tracks": []
|
||||
}
|
||||
|
||||
def save_cache(cache):
|
||||
with open(CACHE_FILE, "w") as f:
|
||||
json.dump(cache, f, indent=2)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue