add new album header

This commit is contained in:
geoffrey45
2022-02-19 18:43:17 +03:00
parent dcfb0a6ed1
commit a6bb5059b0
18 changed files with 101 additions and 189 deletions
+1 -1
View File
@@ -197,7 +197,7 @@ def get_artist_data(artist: str):
@bp.route("/f/<folder>")
# @cache.cached(30)
@cache.cached()
def get_folder_tree(folder: str):
"""
Returns a list of all the folders and tracks in the given folder.
+16 -7
View File
@@ -35,12 +35,11 @@ def add_track(filepath: str) -> None:
Processes the audio tags for a given file ands add them to the music dict.
"""
tags = functions.get_tags(filepath)
print(tags)
if tags is not None:
print("🔵: tags okay")
track_id = instances.songs_instance.insert_song(tags)
track = instances.songs_instance.get_song_by_id(track_id)
print(track_id)
instances.songs_instance.insert_song(tags)
track = instances.songs_instance.get_song_by_path(tags["filepath"])
track_obj = functions.create_track_class(track)
api.all_the_f_music.append(track_obj)
@@ -55,7 +54,6 @@ def remove_track(filepath: str) -> None:
for track in api.all_the_f_music:
if track.track_id == track_id:
pprint(track)
api.all_the_f_music.remove(track)
@@ -90,8 +88,19 @@ class Handler(PatternMatchingEventHandler):
Fired when a move event occurs on a supported file.
"""
print("🔘 moved -->")
remove_track(event.src_path)
add_track(event.dest_path)
tr = "share/Trash"
if tr in event.dest_path:
print("trash ++")
remove_track(event.src_path)
elif tr in event.src_path:
add_track(event.dest_path)
elif tr not in event.dest_path and tr not in event.src_path:
add_track(event.dest_path)
remove_track(event.src_path)
def on_closed(self, event):
"""