swingmusic/app/lib/trackslib.py
geoffrey45 e3ec9db989 add method and route to search across tracks, albums and artists.
+ break models into separate files
+ same for the utils and setup
2023-03-09 13:08:50 +03:00

21 lines
543 B
Python

"""
This library contains all the functions related to tracks.
"""
import os
from tqdm import tqdm
from app.db.store import Store
from app.db.sqlite.tracks import SQLiteTrackMethods as tdb
def validate_tracks() -> None:
"""
Gets all songs under the ~/ directory.
"""
for track in tqdm(Store.tracks, desc="Removing deleted tracks"):
if not os.path.exists(track.filepath):
print(f"Removing {track.filepath}")
Store.tracks.remove(track)
tdb.remove_track_by_filepath(track.filepath)