New plex implementation
This commit is contained in:
parent
bd5b3538c8
commit
56e1061325
6 changed files with 121 additions and 6 deletions
29
create_monthly_playlist.py
Normal file
29
create_monthly_playlist.py
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
#create_monthly_playlist.py
|
||||
from plex_helpers import create_or_update_playlist
|
||||
from musicbrainz_helpers import load_cache
|
||||
import time
|
||||
|
||||
def main():
|
||||
cache = load_cache()
|
||||
added_artists = cache.get("added_artists", [])
|
||||
added_tracks = cache.get("added_tracks", [])
|
||||
|
||||
if not added_artists:
|
||||
print("[PLEX] Ingen artist har lagts till ännu.")
|
||||
return
|
||||
|
||||
print(f"[PLEX] Skapar spellista för {len(added_artists)} artister...")
|
||||
timestamp = time.strftime("%Y-%m")
|
||||
playlist_name = f"DiscoveryLidarr {timestamp}"
|
||||
|
||||
success, new_tracks = create_or_update_playlist(
|
||||
playlist_name, added_artists, top_n=3, already_added=added_tracks
|
||||
)
|
||||
|
||||
if success:
|
||||
cache["added_tracks"] = list(set(added_tracks + new_tracks))
|
||||
print(f"[PLEX] 🎵 Spellistan '{playlist_name}' skapad med {len(new_tracks)} nya spår.")
|
||||
from musicbrainz_helpers import save_cache
|
||||
save_cache(cache)
|
||||
else:
|
||||
print(f"[PLEX] ❌ Spellistan '{playlist_name}' kunde inte skapas.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue