mirror of
https://github.com/tcsenpai/swingmusic.git
synced 2025-06-09 12:37:22 +00:00
28 lines
659 B
Python
28 lines
659 B
Python
"""
|
|
Contains methods relating to albums.
|
|
"""
|
|
|
|
from alive_progress import alive_bar
|
|
|
|
from app.store.albums import AlbumStore
|
|
from app.store.tracks import TrackStore
|
|
from app.logger import log
|
|
|
|
|
|
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
|
|
|
|
with alive_bar(len(albums)) as bar:
|
|
log.info("Validating albums")
|
|
for album in albums:
|
|
if album.albumhash not in album_hashes:
|
|
AlbumStore.remove_album(album)
|
|
bar()
|