bug fixes

This commit is contained in:
cwilvx
2025-01-10 14:33:34 +03:00
parent ec9f392d73
commit 82e303f2df
5 changed files with 16 additions and 44 deletions
+4 -2
View File
@@ -78,7 +78,8 @@ def toggle_favorite(body: FavoritesAddBody):
FavoritesTable.insert_item(
{"hash": body.hash, "type": body.type, "extra": extra}
)
except:
except Exception as e:
print(e)
return {"msg": "Failed! An error occured"}, 500
toggle_fav(body.type, body.hash)
@@ -93,7 +94,8 @@ def remove_favorite(body: FavoritesAddBody):
"""
try:
FavoritesTable.remove_item({"hash": body.hash, "type": body.type})
except:
except Exception as e:
print(e)
return {"msg": "Failed! An error occured"}, 500
toggle_fav(body.type, body.hash)
+1 -1
View File
@@ -86,7 +86,7 @@ def get_image(_map: tuple[str, Album]):
matching_tracks = AlbumStore.get_album_tracks(album.albumhash)
for track in matching_tracks:
if extract_thumb(track.filepath, track.image):
if extract_thumb(track.filepath, track.albumhash + ".webp"):
break
+1 -1
View File
@@ -69,7 +69,7 @@ class IndexTracks:
for track in tracks:
try:
extract_thumb(
track["filepath"], track["trackhash"] + ".webp", overwrite=True
track["filepath"], track["albumhash"] + ".webp", overwrite=True
)
except FileNotFoundError:
continue
+6 -1
View File
@@ -159,6 +159,11 @@ def get_tags(filepath: str, config: UserConfig):
except Exception as e: # noqa: E722
return None
try:
other = tags.other
except AttributeError:
other = {}
metadata: dict[str, Any] = {
"album": tags.album,
"albumartists": tags.albumartist,
@@ -172,7 +177,7 @@ def get_tags(filepath: str, config: UserConfig):
"track": tags.track,
"disc": tags.disc,
"genres": tags.genre,
"copyright": " ".join(tags.other.get("copyright", [])),
"copyright": " ".join(other.get("copyright", [])),
"extra": {},
}