diff --git a/app/helpers.py b/app/helpers.py index 5e39447..42acedf 100644 --- a/app/helpers.py +++ b/app/helpers.py @@ -132,7 +132,11 @@ def get_audio_metadata(filepath: str) -> Dict[str, str | int | float]: metadata: Dict[str, str | int | float] = {} - metadata["mtime"] = os.path.getmtime(filepath) + try: + metadata["mtime"] = os.path.getmtime(filepath) + except FileNotFoundError: + show_warning(None, "File not found", f"Filepath {filepath} not found") + return {} # Set start_gap, fade_at and silence_at audio = get_audio_segment(filepath) @@ -200,7 +204,10 @@ def get_tags(path: str) -> Dict[str, Any]: Return a dictionary of title, artist, duration-in-milliseconds and path. """ - tag = TinyTag.get(path) + try: + tag = TinyTag.get(path) + except FileNotFoundError: + return {} return dict( title=tag.title,