rewrite db stuff with scalars and generators

+ dump mixes with less than x=4 artists
+ try: disable pragma mmap_size
This commit is contained in:
cwilvx
2025-02-23 20:48:40 +03:00
parent a6814407b8
commit 07a4f97e17
17 changed files with 299 additions and 252 deletions
+5
View File
@@ -33,6 +33,7 @@ class MixAlreadyExists(Exception):
class MixesPlugin(Plugin):
MAX_TRACKS_TO_FETCH = 5
MIN_TRACK_MIX_LENGTH = 15
MIN_ARTISTS_PER_MIX = 4
MIX_TRACKS_LENGTH = 40
MIN_DAY_LISTEN_DURATION = 3 * 60 # 3 minutes
@@ -291,6 +292,10 @@ class MixesPlugin(Plugin):
if len(mix_tracks) < self.MIN_TRACK_MIX_LENGTH:
return None
# INFO: Dump mixes with no variety
if len(set(t.artisthashes[0] for t in mix_tracks)) < self.MIN_ARTISTS_PER_MIX:
return None
# try downloading artist image
mix_image = {"image": _artist.artist.image, "color": _artist.artist.color}
image = self.download_artist_image(_artist.artist)