add function to validate albums

+ extract colors in watchdogg
+ rename color db files
This commit is contained in:
mungai-njoroge
2023-07-12 08:56:30 +03:00
parent 4a7416853a
commit 861a854f91
18 changed files with 170 additions and 38 deletions
+20 -1
View File
@@ -1,3 +1,22 @@
"""
Contains methods relating to albums.
"""
"""
from tqdm import tqdm
from app.store.albums import AlbumStore
from app.store.tracks import TrackStore
def validate_albums():
"""
Removes albums that have no tracks.
Probably albums that were added from incompletely written files.
"""
album_hashes = {t.albumhash for t in TrackStore.tracks}
albums = AlbumStore.albums
for album in tqdm(albums, desc="Validating albums"):
if album.albumhash not in album_hashes:
AlbumStore.remove_album(album)