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
|
import time
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
|
print("Startar spellistgenerator")
|
||||||
cache = load_cache()
|
cache = load_cache()
|
||||||
added_artists = cache.get("added_artists", [])
|
added_artists = cache.get("added_artists", [])
|
||||||
added_tracks = cache.get("added_tracks", [])
|
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:
|
if not added_artists:
|
||||||
print("[PLEX] Ingen artist har lagts till ännu.")
|
print("[PLEX] Ingen artist har lagts till ännu.")
|
||||||
|
|
|
||||||
|
|
@ -14,10 +14,19 @@ def load_cache():
|
||||||
"added_tracks": []
|
"added_tracks": []
|
||||||
}, f)
|
}, f)
|
||||||
with open(CACHE_FILE, "r") as 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:
|
except Exception:
|
||||||
return {
|
return {
|
||||||
"added_artists": [],
|
"added_artists": [],
|
||||||
"similar_cache": {},
|
"similar_cache": {},
|
||||||
"added_tracks": []
|
"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