mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-05 13:03:02 +00:00
fix keyError
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
from datetime import datetime
|
from datetime import datetime
|
||||||
from time import time
|
|
||||||
|
|
||||||
from app.lib.playlistlib import get_first_4_images
|
from app.lib.playlistlib import get_first_4_images
|
||||||
from app.models.playlist import Playlist
|
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.albums import AlbumStore
|
||||||
from app.store.artists import ArtistStore
|
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 itertools import groupby
|
||||||
|
|
||||||
from app.utils import flatten
|
from app.utils import flatten
|
||||||
from app.utils.dates import (
|
from app.utils.dates import (
|
||||||
create_new_date,
|
create_new_date,
|
||||||
date_string_to_time_passed,
|
date_string_to_time_passed,
|
||||||
timestamp_to_time_passed,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
older_albums = set()
|
older_albums = set()
|
||||||
@@ -65,14 +59,6 @@ def create_track(t: Track):
|
|||||||
"timestamp": t.last_mod,
|
"timestamp": t.last_mod,
|
||||||
"help_text": "NEW TRACK",
|
"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)
|
# INFO: Keys: folder, tracks, time (timestamp)
|
||||||
# group_type = dict[str, str | list[Track] | float]
|
# group_type = dict[str, str | list[Track] | float]
|
||||||
@@ -89,7 +75,7 @@ def check_folder_type(group_: dict):
|
|||||||
|
|
||||||
if len(tracks) == 1:
|
if len(tracks) == 1:
|
||||||
entry = create_track(tracks[0])
|
entry = create_track(tracks[0])
|
||||||
entry["item"]["time"] = timestamp_to_time_passed(time)
|
entry["timestamp"] = time
|
||||||
return entry
|
return entry
|
||||||
|
|
||||||
is_album, albumhash, _ = check_is_album_folder(tracks)
|
is_album, albumhash, _ = check_is_album_folder(tracks)
|
||||||
@@ -100,18 +86,6 @@ def check_folder_type(group_: dict):
|
|||||||
if entry is None:
|
if entry is None:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# album = album_serializer(
|
|
||||||
# entry.album,
|
|
||||||
# to_remove={
|
|
||||||
# "genres",
|
|
||||||
# "og_title",
|
|
||||||
# "date",
|
|
||||||
# "duration",
|
|
||||||
# "count",
|
|
||||||
# "albumartists_hashes",
|
|
||||||
# "base_title",
|
|
||||||
# },
|
|
||||||
# )
|
|
||||||
return {
|
return {
|
||||||
"type": "album",
|
"type": "album",
|
||||||
"hash": albumhash,
|
"hash": albumhash,
|
||||||
@@ -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)
|
is_track_folder = check_is_track_folder(tracks)
|
||||||
|
|
||||||
return (
|
return (
|
||||||
@@ -159,12 +121,6 @@ def check_folder_type(group_: dict):
|
|||||||
"hash": key,
|
"hash": key,
|
||||||
"timestamp": time,
|
"timestamp": time,
|
||||||
"help_text": "NEW MUSIC",
|
"help_text": "NEW MUSIC",
|
||||||
# "item": {
|
|
||||||
# "path": key,
|
|
||||||
# "count": len(tracks),
|
|
||||||
# "help_text": "NEW MUSIC",
|
|
||||||
# "time": timestamp_to_time_passed(time),
|
|
||||||
# },
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user