diff --git a/app/db/userdata.py b/app/db/userdata.py index 8bb35d31..41d34226 100644 --- a/app/db/userdata.py +++ b/app/db/userdata.py @@ -345,8 +345,12 @@ class PlaylistTable(Base): ) @classmethod - def get_all(cls): - result = cls.all() + def get_all(cls, current_user: bool = True): + if current_user: + result = cls.execute(select(cls).where(cls.userid == get_current_userid())) + else: + result = cls.execute(select(cls)) + return playlists_to_dataclasses(result) @classmethod diff --git a/app/lib/home/recentlyplayed.py b/app/lib/home/recentlyplayed.py index 1797c01c..6aee67d1 100644 --- a/app/lib/home/recentlyplayed.py +++ b/app/lib/home/recentlyplayed.py @@ -158,7 +158,7 @@ def get_recently_played( entries = _entries limit = 1 else: - entries = ScrobbleTable.get_all(0, BATCH_SIZE) + entries = ScrobbleTable.get_all(0, BATCH_SIZE, userid=userid) max_iterations = 20 iterations = 0 diff --git a/app/plugins/mixes.py b/app/plugins/mixes.py index 69d60e03..d4171b17 100644 --- a/app/plugins/mixes.py +++ b/app/plugins/mixes.py @@ -201,6 +201,8 @@ class MixesPlugin(Plugin): }, } + # FIXME: Make sure that different artists don't generate the same mix + for i, period in enumerate(artists.values()): # if previous period has less than its max # add the difference to this period's limit @@ -226,6 +228,7 @@ class MixesPlugin(Plugin): period["created"] += 1 print(f"⭐⭐⭐⭐ Created {len(mixes)} mixes") + print([m.title for m in mixes]) return mixes def get_mix_description(self, tracks: list[Track], artishash: str):