[mod] odysee: move format_duration helper into utils.py

This commit is contained in:
Bnyro
2026-05-31 10:05:37 +02:00
parent a1490676e3
commit ab13451086
2 changed files with 11 additions and 10 deletions
+10
View File
@@ -1,6 +1,7 @@
# SPDX-License-Identifier: AGPL-3.0-or-later
"""Utility functions for the engines"""
import time
import re
import importlib
@@ -809,3 +810,12 @@ def parse_duration_string(duration_str: str) -> timedelta | None:
pass
return None
# Format the video duration
def format_duration(duration):
seconds = int(duration)
length = time.gmtime(seconds)
if length.tm_hour:
return time.strftime("%H:%M:%S", length)
return time.strftime("%M:%S", length)