summaryrefslogtreecommitdiff
path: root/searx/utils.py
diff options
context:
space:
mode:
authorBnyro <bnyro@tutanota.com>2026-05-31 10:05:37 +0200
committerBnyro <bnyro@tutanota.com>2026-06-11 16:09:13 +0200
commitab1345108635af920b18ee8616a720bcd2f75f0c (patch)
tree146b9e03fe7e622594388e36f3f37dedfe276565 /searx/utils.py
parenta1490676e3c04239b3a314cb1fbb3144bc894b14 (diff)
[mod] odysee: move format_duration helper into utils.py
Diffstat (limited to 'searx/utils.py')
-rw-r--r--searx/utils.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/searx/utils.py b/searx/utils.py
index 9a7968ab7..8e03ae5b7 100644
--- a/searx/utils.py
+++ b/searx/utils.py
@@ -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)