From c3cc44bdf7020d8baee862ec2b503f59bca27077 Mon Sep 17 00:00:00 2001 From: jonathan Date: Mon, 10 Jan 2022 11:59:55 +0100 Subject: [PATCH] convert seconds to time --- ffplayout/utils.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/ffplayout/utils.py b/ffplayout/utils.py index ed2f6dfd..a7451200 100644 --- a/ffplayout/utils.py +++ b/ffplayout/utils.py @@ -157,6 +157,15 @@ def str_to_sec(time_str): sys.exit(1) +def sec_to_time(seconds): + """ + convert float number to time string in hh:mm:ss + """ + min, sec = divmod(seconds, 60) + hours, min = divmod(min, 60) + return f'{int(hours):d}:{int(min):02d}:{int(sec):02d}' + + def read_config(): """ read yaml config @@ -879,7 +888,7 @@ def gen_filler(node): if node['duration'] > duration: # cut filler messenger.info( - f'Generate filler with {duration:.2f} seconds') + f'Generate filler') node['src_cmd'] = ['-i', storage.filler] + set_length( node['duration'], 0, duration) return node