audio: split into more modules

This commit is contained in:
2025-02-09 03:05:44 -05:00
parent af0896a6a0
commit 69f4d6967f
10 changed files with 234 additions and 217 deletions

7
audio/utils.py Normal file
View File

@@ -0,0 +1,7 @@
def format_duration(duration: int | float) -> str:
hours, duration = divmod(int(duration), 3600)
minutes, duration = divmod(duration, 60)
segments = [hours, minutes, duration]
if len(segments) == 3 and segments[0] == 0:
del segments[0]
return f"{':'.join(f'{s:0>2}' for s in segments)}"