rewrite get all endpoint with stores

This commit is contained in:
cwilvx
2024-07-15 00:50:18 +03:00
parent 58c90d95b1
commit 88a72763df
3 changed files with 26 additions and 9 deletions
+8
View File
@@ -8,6 +8,7 @@ from app.db.sqlite.albumcolors import SQLiteAlbumMethods as aldb
from app.lib.tagger import create_albums
from app.models import Album, Track
from app.store.artists import ArtistStore
from app.utils import flatten
from app.utils.customlist import CustomList
from app.utils.remove_duplicates import remove_duplicates
@@ -76,6 +77,13 @@ class AlbumStore:
print("Done!")
@classmethod
def get_flat_list(cls):
"""
Returns a flat list of all albums.
"""
return [a.album for a in cls.albummap.values()]
@classmethod
def add_album(cls, album: Album):
"""
+8
View File
@@ -4,6 +4,7 @@ from typing import Iterable
from app.db.sqlite.artistcolors import SQLiteArtistMethods as ardb
from app.lib.tagger import create_artists
from app.models import Artist
from app.utils import flatten
from app.utils.bisection import use_bisection
from app.utils.customlist import CustomList
from app.utils.progressbar import tqdm
@@ -57,6 +58,13 @@ class ArtistStore:
# cls.map_artist_color(artist)
@classmethod
def get_flat_list(cls):
"""
Returns a flat list of all artists.
"""
return [a.artist for a in cls.artistmap.values()]
@classmethod
def map_artist_color(cls, artist_tuple: tuple):
"""