@@ -932,7 +932,7 @@ def merge(self, index: int, object) -> None:
932
932
class AlbumStarStore:
933
933
934
934
def __init__(self, tauon: Tauon) -> None:
935
- self.db = {}
935
+ self.db: dict[str, int] = {}
936
936
self.subsonic = SubsonicService(tauon=tauon, album_star_store=self)
937
937
938
938
def get_key(self, track_object: TrackClass) -> str:
@@ -941,19 +941,19 @@ def get_key(self, track_object: TrackClass) -> str:
941
941
artist = track_object.artist
942
942
return artist + ":" + track_object.album
943
943
944
- def get_rating(self, track_object: TrackClass):
944
+ def get_rating(self, track_object: TrackClass) -> int :
945
945
return self.db.get(self.get_key(track_object), 0)
946
946
947
- def set_rating(self, track_object: TrackClass, rating) -> None:
947
+ def set_rating(self, track_object: TrackClass, rating: int ) -> None:
948
948
self.db[self.get_key(track_object)] = rating
949
949
if track_object.file_ext == "SUB":
950
950
self.db[self.get_key(track_object)] = math.ceil(rating / 2) * 2
951
951
self.subsonic.set_album_rating(track_object, rating)
952
952
953
- def set_rating_artist_title(self, artist: str, album: str, rating) -> None:
953
+ def set_rating_artist_title(self, artist: str, album: str, rating: int ) -> None:
954
954
self.db[artist + ":" + album] = rating
955
955
956
- def get_rating_artist_title(self, artist: str, album: str):
956
+ def get_rating_artist_title(self, artist: str, album: str) -> int :
957
957
return self.db.get(artist + ":" + album, 0)
958
958
959
959
class Fonts:
@@ -18125,7 +18125,7 @@ def get_music3(self, return_list: bool = False):
18125
18125
self.scanning = True
18126
18126
self.gui.to_got = 0
18127
18127
18128
- existing = {}
18128
+ existing: dict[str, int] = {}
18129
18129
18130
18130
for track_id, track in self.pctl.master_library.items():
18131
18131
if track.is_network and track.file_ext == "SUB":
@@ -18139,9 +18139,12 @@ def get_music3(self, return_list: bool = False):
18139
18139
self.scanning = False
18140
18140
return []
18141
18141
18142
+ if "indexes" not in a["subsonic-response"]:
18143
+ logging.critical("Failed to find expected key 'indexes', report a bug with the log below!")
18144
+ logging.critical(a["subsonic-response"])
18142
18145
b = a["subsonic-response"]["indexes"]["index"]
18143
18146
18144
- folders = []
18147
+ folders: list[tuple[str, str]] = []
18145
18148
18146
18149
for letter in b:
18147
18150
artists = letter["artist"]
@@ -18151,14 +18154,14 @@ def get_music3(self, return_list: bool = False):
18151
18154
artist["name"],
18152
18155
))
18153
18156
18154
- playlist = []
18155
- songsets = []
18157
+ playlist: list[int] = []
18158
+ songsets: list[tuple[TrackClass, str, str, int]] = []
18156
18159
for i in range(len(folders)):
18157
18160
songsets.append([])
18158
18161
statuses = [0] * len(folders)
18159
- dupes = []
18162
+ # dupes = []
18160
18163
18161
- def getsongs(index, folder_id, name: str, inner: bool = False, parent= None) -> None:
18164
+ def getsongs(index: int , folder_id: str , name: str, inner: bool = False, parent: dict[str, str | int] | None = None) -> None:
18162
18165
try:
18163
18166
d = self.r("getMusicDirectory", p={"id": folder_id})
18164
18167
if "child" not in d["subsonic-response"]["directory"]:
@@ -18180,7 +18183,7 @@ def getsongs(index, folder_id, name: str, inner: bool = False, parent=None) -> N
18180
18183
self.gui.update = 2
18181
18184
18182
18185
for item in items:
18183
- if item["isDir"]:
18186
+ if "isDir" in item and item["isDir"]:
18184
18187
if "userRating" in item and "artist" in item:
18185
18188
rating = item["userRating"]
18186
18189
if self.album_star_store.get_rating_artist_title(item["artist"], item["title"]) == 0 and rating == 0:
0 commit comments