This commit is contained in:
mungai-njoroge
2023-07-17 11:30:05 +03:00
parent 861a854f91
commit e70d787580
4 changed files with 26 additions and 7 deletions
+7 -2
View File
@@ -186,6 +186,7 @@ def add_track(filepath: str) -> None:
extract_thumb(filepath, track.image)
def remove_track(filepath: str) -> None:
"""
Removes a track from the music dict.
@@ -311,7 +312,11 @@ class Handler(PatternMatchingEventHandler):
time.sleep(5)
# Check the file size again
current_size = os.path.getsize(event.src_path)
try:
current_size = os.path.getsize(event.src_path)
except FileNotFoundError:
# File was deleted
return
if current_size == previous_size:
try:
@@ -322,7 +327,7 @@ class Handler(PatternMatchingEventHandler):
self.files_to_process_windows.remove(event.src_path)
del self.file_sizes[event.src_path]
except OSError:
# File is locked, skipping
# File is locked
pass
return