mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-07-28 13:41:42 +00:00
fix: artist and album colors not being assigned when root dir is changed
This commit is contained in:
parent
7640f2cc1a
commit
43732ba380
@ -38,14 +38,10 @@ class ProcessAlbumColors:
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
db_colors = db.get_all_albums()
|
||||
db_albumhashes = "-".join([album[1] for album in db_colors])
|
||||
|
||||
albums = [a for a in Store.albums if a.albumhash not in db_albumhashes]
|
||||
albums = [a for a in Store.albums if len(a.colors) == 0]
|
||||
|
||||
with SQLiteManager() as cur:
|
||||
for album in tqdm(albums, desc="Processing unprocessed album colors"):
|
||||
if len(album.colors) == 0:
|
||||
for album in tqdm(albums, desc="Processing missing album colors"):
|
||||
colors = self.process_color(album)
|
||||
|
||||
if colors is None:
|
||||
@ -73,12 +69,9 @@ class ProcessArtistColors:
|
||||
"""
|
||||
|
||||
def __init__(self) -> None:
|
||||
db_colors: list[tuple] = list(adb.get_all_artists())
|
||||
db_artisthashes = "-".join([artist[1] for artist in db_colors])
|
||||
all_artists = [a for a in Store.artists if a.artisthash not in db_artisthashes]
|
||||
all_artists = [a for a in Store.artists if len(a.colors) == 0]
|
||||
|
||||
for artist in tqdm(all_artists, desc="Processing unprocessed artist colors"):
|
||||
if artist.artisthash not in db_artisthashes:
|
||||
for artist in tqdm(all_artists, desc="Processing missing artist colors"):
|
||||
self.process_color(artist)
|
||||
|
||||
@staticmethod
|
||||
@ -93,3 +86,12 @@ class ProcessArtistColors:
|
||||
if len(colors) > 0:
|
||||
adb.insert_one_artist(artisthash=artist.artisthash, colors=colors)
|
||||
Store.map_artist_color((0, artist.artisthash, json.dumps(colors)))
|
||||
|
||||
# TODO: If item color is in db, get it, assign it to the item and continue.
|
||||
# - Format all colors in the format: rgb(123, 123, 123)
|
||||
# - Each digit should be 3 digits long.
|
||||
# - Format all db colors into a master string of the format "-itemhash:colorhash-"
|
||||
# - Find the item hash using index() and get the color using the index + number, where number
|
||||
# is the length of the rgb string + 1
|
||||
# - Assign the color to the item and continue.
|
||||
# - If the color is not in the db, extract it and add it to the db.
|
||||
|
Loading…
x
Reference in New Issue
Block a user