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
+9 -3
View File
@@ -33,16 +33,22 @@ def map_scrobble_data():
if track is None:
continue
track.increment_playcount(data["playduration"], data["lastplayed"], data["playcount"])
track.increment_playcount(
data["playduration"], data["lastplayed"], data["playcount"]
)
album = AlbumStore.albummap.get(track.tracks[0].albumhash)
if album:
album.increment_playcount(data["playduration"], data["lastplayed"], data["playcount"])
album.increment_playcount(
data["playduration"], data["lastplayed"], data["playcount"]
)
for artisthash in track.tracks[0].artisthashes:
artist = ArtistStore.artistmap.get(artisthash)
if artist:
artist.increment_playcount(data["playduration"], data["lastplayed"], data["playcount"])
artist.increment_playcount(
data["playduration"], data["lastplayed"], data["playcount"]
)
def map_favorites():
+2 -2
View File
@@ -28,7 +28,7 @@ def create_thumbnail(image: Any, img_path: str) -> str:
new_w = round(250 * aspect_ratio)
thumb = image.resize((new_w, 250), Image.ANTIALIAS)
thumb = image.resize((new_w, 250), Image.Resampling.LANCZOS)
thumb.save(full_thumb_path, "webp")
return thumb_path
@@ -50,7 +50,7 @@ def create_gif_thumbnail(image: Any, img_path: str):
new_w = round(250 * aspect_ratio)
thumb = frame.resize((new_w, 250), Image.ANTIALIAS)
thumb = frame.resize((new_w, 250), Image.Resampling.LANCZOS)
frames.append(thumb)
frames[0].save(full_thumb_path, save_all=True, append_images=frames[1:])
+1 -2
View File
@@ -169,8 +169,7 @@ class FetchSimilarArtistsLastFM:
def __init__(self, instance_key: str) -> None:
# read all artists from db
processed = SimilarArtistTable.get_all()
processed = ".".join(a for a in processed)
processed = set(a.artisthash for a in SimilarArtistTable.get_all())
# filter out artists that already have similar artists
artists = filter(