From 9de991dd98405eeba9f2ab14596c925126ddb51c Mon Sep 17 00:00:00 2001 From: cwilvx Date: Sun, 17 Nov 2024 20:06:08 +0100 Subject: [PATCH] fix keyError --- app/lib/home/recentlyadded.py | 48 ++--------------------------------- 1 file changed, 2 insertions(+), 46 deletions(-) diff --git a/app/lib/home/recentlyadded.py b/app/lib/home/recentlyadded.py index 58ef1184..a4251fd1 100644 --- a/app/lib/home/recentlyadded.py +++ b/app/lib/home/recentlyadded.py @@ -1,5 +1,4 @@ from datetime import datetime -from time import time from app.lib.playlistlib import get_first_4_images from app.models.playlist import Playlist @@ -9,17 +8,12 @@ from app.store.tracks import TrackStore from app.store.albums import AlbumStore from app.store.artists import ArtistStore -from app.serializers.track import serialize_track -from app.serializers.album import album_serializer -from app.serializers.artist import serialize_for_card - from itertools import groupby from app.utils import flatten from app.utils.dates import ( create_new_date, date_string_to_time_passed, - timestamp_to_time_passed, ) older_albums = set() @@ -65,14 +59,6 @@ def create_track(t: Track): "timestamp": t.last_mod, "help_text": "NEW TRACK", } - # track = serialize_track(t, to_remove={"created_date"}) - # track["help_text"] = "NEW TRACK" - - # return { - # "type": "track", - # "item": track, - # } - # INFO: Keys: folder, tracks, time (timestamp) # group_type = dict[str, str | list[Track] | float] @@ -89,7 +75,7 @@ def check_folder_type(group_: dict): if len(tracks) == 1: entry = create_track(tracks[0]) - entry["item"]["time"] = timestamp_to_time_passed(time) + entry["timestamp"] = time return entry is_album, albumhash, _ = check_is_album_folder(tracks) @@ -100,18 +86,6 @@ def check_folder_type(group_: dict): if entry is None: return None - # album = album_serializer( - # entry.album, - # to_remove={ - # "genres", - # "og_title", - # "date", - # "duration", - # "count", - # "albumartists_hashes", - # "base_title", - # }, - # ) return { "type": "album", "hash": albumhash, @@ -127,7 +101,7 @@ def check_folder_type(group_: dict): if entry is None: return None - + return { "type": "artist", "hash": artisthash, @@ -137,18 +111,6 @@ def check_folder_type(group_: dict): ), } - # artist = serialize_for_card(entry.artist) - # artist["trackcount"] = trackcount - # artist["help_text"] = ( - # "NEW ARTIST" if artisthash not in existing_artist_hashes else "NEW MUSIC" - # ) - # artist["time"] = timestamp_to_time_passed(time) - - # return { - # "type": "artist", - # "item": artist, - # } - is_track_folder = check_is_track_folder(tracks) return ( @@ -159,12 +121,6 @@ def check_folder_type(group_: dict): "hash": key, "timestamp": time, "help_text": "NEW MUSIC", - # "item": { - # "path": key, - # "count": len(tracks), - # "help_text": "NEW MUSIC", - # "time": timestamp_to_time_passed(time), - # }, } )