From 9f9a5ccf4458c6d19aa9224e3b91e4d6342bfb0d Mon Sep 17 00:00:00 2001 From: Travis Abendshien <46939827+CyanVoxel@users.noreply.github.com> Date: Mon, 3 Mar 2025 11:26:07 -0800 Subject: [PATCH] fix: catch `OverflowError` when displaying video duration --- tagstudio/src/qt/widgets/preview/file_attributes.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/tagstudio/src/qt/widgets/preview/file_attributes.py b/tagstudio/src/qt/widgets/preview/file_attributes.py index 8fc19f8a..c6254650 100644 --- a/tagstudio/src/qt/widgets/preview/file_attributes.py +++ b/tagstudio/src/qt/widgets/preview/file_attributes.py @@ -211,11 +211,14 @@ class FileAttributes(QWidget): if duration_text: stats_label_text = add_newline(stats_label_text) - dur_str = str(timedelta(seconds=float(duration_text)))[:-7] - if dur_str.startswith("0:"): - dur_str = dur_str[2:] - if dur_str.startswith("0"): - dur_str = dur_str[1:] + try: + dur_str = str(timedelta(seconds=float(duration_text)))[:-7] + if dur_str.startswith("0:"): + dur_str = dur_str[2:] + if dur_str.startswith("0"): + dur_str = dur_str[1:] + except OverflowError: + dur_str = "-:--" stats_label_text += f"{dur_str}" if font_family: