mirror of
https://github.com/Dvorinka/swingmusic-extended.git
synced 2026-06-04 20:43:04 +00:00
major refactors
- add album page store - show loaders in beforeEnter guards - show bitrate on now playing card - etc
This commit is contained in:
@@ -54,3 +54,4 @@ def get_track_by_id(trackid: str) -> models.Track:
|
||||
for track in api.TRACKS:
|
||||
if track.trackid == trackid:
|
||||
return track
|
||||
|
||||
|
||||
@@ -60,19 +60,24 @@ def add_track(filepath: str) -> None:
|
||||
api.TRACKS.append(models.Track(tags))
|
||||
|
||||
folder = folderslib.create_folder(tags["folder"])
|
||||
print(f"💙💙 {tags['folder']}")
|
||||
print(folder)
|
||||
|
||||
if folder not in api.FOLDERS:
|
||||
api.FOLDERS.append(folder)
|
||||
print(f"added folder {folder.path}")
|
||||
|
||||
|
||||
def remove_track(filepath: str) -> None:
|
||||
"""
|
||||
Removes a track from the music dict.
|
||||
"""
|
||||
print(filepath)
|
||||
fpath = filepath.split("/")[-1]
|
||||
|
||||
try:
|
||||
trackid = instances.songs_instance.get_song_by_path(filepath)["_id"]["$oid"]
|
||||
except TypeError:
|
||||
print(f"💙 Watchdog Error: Error removing track {filepath} TypeError")
|
||||
return
|
||||
|
||||
instances.songs_instance.remove_song_by_id(trackid)
|
||||
@@ -81,6 +86,10 @@ def remove_track(filepath: str) -> None:
|
||||
if track.trackid == trackid:
|
||||
api.TRACKS.remove(track)
|
||||
|
||||
for folder in api.FOLDERS:
|
||||
if folder.path == filepath.replace(fpath, ""):
|
||||
api.FOLDERS.remove(folder)
|
||||
|
||||
|
||||
class Handler(PatternMatchingEventHandler):
|
||||
files_to_process = []
|
||||
|
||||
Reference in New Issue
Block a user