add timestamp to favorite entries

+ convert useBisection into a function
This commit is contained in:
mungai-njoroge
2024-03-10 17:21:22 +03:00
committed by Mungai Njoroge
parent fb635ff35f
commit 766eb388b2
9 changed files with 95 additions and 52 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ import json
from app.db.sqlite.artistcolors import SQLiteArtistMethods as ardb
from app.lib.artistlib import get_all_artists
from app.models import Artist
from app.utils.bisection import UseBisection
from app.utils.bisection import use_bisection
from app.utils.customlist import CustomList
from app.utils.progressbar import tqdm
@@ -72,7 +72,7 @@ class ArtistStore:
"""
artists = sorted(cls.artists, key=lambda x: x.artisthash)
try:
artist = UseBisection(artists, "artisthash", [artisthash])()[0]
artist = use_bisection(artists, "artisthash", [artisthash])[0]
return artist
except IndexError:
return None
@@ -83,7 +83,7 @@ class ArtistStore:
Returns artists by their hashes.
"""
artists = sorted(cls.artists, key=lambda x: x.artisthash)
artists = UseBisection(artists, "artisthash", artisthashes)()
artists = use_bisection(artists, "artisthash", artisthashes)
return [a for a in artists if a is not None]
@classmethod
+2 -2
View File
@@ -3,7 +3,7 @@
from app.db.sqlite.favorite import SQLiteFavoriteMethods as favdb
from app.db.sqlite.tracks import SQLiteTrackMethods as tdb
from app.models import Track
from app.utils.bisection import UseBisection
from app.utils.bisection import use_bisection
from app.utils.customlist import CustomList
from app.utils.remove_duplicates import remove_duplicates
@@ -153,7 +153,7 @@ class TrackStore:
Returns all tracks matching the given paths.
"""
tracks = sorted(cls.tracks, key=lambda x: x.filepath)
tracks = UseBisection(tracks, "filepath", paths)()
tracks = use_bisection(tracks, "filepath", paths)
return [track for track in tracks if track is not None]
@classmethod