mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-07 03:35:35 +00:00
fix duplicate albums with date = 0
This commit is contained in:
parent
dbfa395207
commit
1cf5d38a96
@ -262,6 +262,9 @@ def get_artist_albums(artisthash: str):
|
|||||||
|
|
||||||
artist = ArtistStore.get_artist_by_hash(artisthash)
|
artist = ArtistStore.get_artist_by_hash(artisthash)
|
||||||
|
|
||||||
|
if artist is None:
|
||||||
|
return {"error": "Artist not found"}, 404
|
||||||
|
|
||||||
if return_all is not None:
|
if return_all is not None:
|
||||||
limit = len(all_albums)
|
limit = len(all_albums)
|
||||||
|
|
||||||
|
@ -129,13 +129,13 @@ def add_track(filepath: str) -> None:
|
|||||||
|
|
||||||
Then creates the folder, album and artist objects for the added track and adds them to the store.
|
Then creates the folder, album and artist objects for the added track and adds them to the store.
|
||||||
"""
|
"""
|
||||||
# remove the track if it already exists
|
|
||||||
TrackStore.remove_track_by_filepath(filepath)
|
TrackStore.remove_track_by_filepath(filepath)
|
||||||
|
|
||||||
# add the track to the database and store.
|
|
||||||
tags = get_tags(filepath)
|
tags = get_tags(filepath)
|
||||||
|
|
||||||
if tags is None:
|
# if the track is somehow invalid, return
|
||||||
|
if tags is None or tags["bitrate"] == 0 or tags["duration"] == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
with SQLiteManager() as cur:
|
with SQLiteManager() as cur:
|
||||||
|
@ -61,8 +61,11 @@ class ArtistStore:
|
|||||||
Returns an artist by its hash.P
|
Returns an artist by its hash.P
|
||||||
"""
|
"""
|
||||||
artists = sorted(cls.artists, key=lambda x: x.artisthash)
|
artists = sorted(cls.artists, key=lambda x: x.artisthash)
|
||||||
artist = UseBisection(artists, "artisthash", [artisthash])()[0]
|
try:
|
||||||
return artist
|
artist = UseBisection(artists, "artisthash", [artisthash])()[0]
|
||||||
|
return artist
|
||||||
|
except IndexError:
|
||||||
|
return None
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def get_artists_by_hashes(cls, artisthashes: list[str]) -> list[Artist]:
|
def get_artists_by_hashes(cls, artisthashes: list[str]) -> list[Artist]:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user