diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2021-04-14 22:00:18 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2021-04-14 22:00:18 +0200 |
| commit | ce0f81618b52da931bcc4144f8ac76d561c3aae1 (patch) | |
| tree | e4dabd445a07985ca282dd53bcccfaba2ce82ea1 /cli | |
| parent | d07dc22cbfe3b269c8f7a8e255678434a6f7c5bb (diff) | |
fix timestampToSeconds
Diffstat (limited to 'cli')
| -rw-r--r-- | cli/app/site/export.py | 15 |
1 files changed, 9 insertions, 6 deletions
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 |
