From ce0f81618b52da931bcc4144f8ac76d561c3aae1 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Wed, 14 Apr 2021 22:00:18 +0200 Subject: fix timestampToSeconds --- cli/app/site/export.py | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) (limited to 'cli/app') diff --git a/cli/app/site/export.py b/cli/app/site/export.py index 2b8b366..89db305 100644 --- a/cli/app/site/export.py +++ b/cli/app/site/export.py @@ -148,9 +148,12 @@ def sanitize_tile(data): del data['target_page_id'] def timestampToSeconds(time_str): - time_str_parts = list(map(float, time_str.strip().split(":"))) - if len(time_str_parts) == 3: - return (time_str_parts[0] * 60 + time_str_parts[1]) * 60 + time_str_parts[2] - if len(time_str_parts) == 2: - return time_str_parts[0] * 60 + time_str_parts[1] - return time_str_parts[0] + try: + time_str_parts = list(map(float, time_str.strip().split(":"))) + if len(time_str_parts) == 3: + return (time_str_parts[0] * 60 + time_str_parts[1]) * 60 + time_str_parts[2] + if len(time_str_parts) == 2: + return time_str_parts[0] * 60 + time_str_parts[1] + return time_str_parts[0] + except: + return 0 -- cgit v1.2.3-70-g09d2