refactor: Improve exception handling and logging in authentication and playlist services; enhance code readability and structure
This commit is contained in:
@@ -34,7 +34,7 @@ def get_audio_duration(file_path: Path) -> int:
|
||||
probe = ffmpeg.probe(str(file_path))
|
||||
duration = float(probe["format"]["duration"])
|
||||
return int(duration * 1000) # Convert to milliseconds
|
||||
except (ffmpeg.Error, KeyError, ValueError, TypeError, Exception) as e:
|
||||
except (ffmpeg.Error, KeyError, ValueError, TypeError, Exception) as e: # noqa: BLE001
|
||||
logger.warning("Failed to get duration for %s: %s", file_path, e)
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user