From: Christian Heller <c.heller@plomlompom.de>
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%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/pick_tasks?a=commitdiff_plain;h=4c23dcbd48f197927e3d5076ffa7d7af4855add9;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]