From: Christian Heller Date: Wed, 25 Dec 2024 20:24:51 +0000 (+0100) Subject: Don't try to ffprobe for duration if file is not actually present. X-Git-Url: https://plomlompom.com/repos/%7B%7Bprefix%7D%7D/%7B%7B%20web_path%20%7D%7D/static/%7B%7Bdb.prefix%7D%7D/day?a=commitdiff_plain;p=ytplom Don't try to ffprobe for duration if file is not actually present. --- diff --git a/src/ytplom/misc.py b/src/ytplom/misc.py index a68edbe..12e7953 100644 --- a/src/ytplom/misc.py +++ b/src/ytplom/misc.py @@ -447,6 +447,8 @@ class VideoFile(DbData): @property def ffprobed_duration(self) -> str: """Return human-friendly formatting of file duration as per ffprobe.""" + if not self.full_path.is_file(): + return '?' json = ffprobe(self.full_path) duration_str = json['format']['duration'] m_seconds_str = duration_str.split('.')[1]