home · contact · privacy
Don't try to ffprobe for duration if file is not actually present. master
authorChristian Heller <c.heller@plomlompom.de>
Wed, 25 Dec 2024 20:24:51 +0000 (21:24 +0100)
committerChristian Heller <c.heller@plomlompom.de>
Wed, 25 Dec 2024 20:24:51 +0000 (21:24 +0100)
src/ytplom/misc.py

index a68edbe85bc6f1a20f234baee4340f38bb19f124..12e7953cc712bc694f329cd61bd0c7b80bdab1dd 100644 (file)
@@ -447,6 +447,8 @@ class VideoFile(DbData):
     @property
     def ffprobed_duration(self) -> str:
         """Return human-friendly formatting of file duration as per ffprobe."""
     @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]
         json = ffprobe(self.full_path)
         duration_str = json['format']['duration']
         m_seconds_str = duration_str.split('.')[1]