Fix preview failing on cameras with - in name (#12093)

This commit is contained in:
Nicolas Mowen 2024-06-21 07:33:20 -06:00 committed by GitHub
parent b34be991bd
commit 3410290b45
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -219,13 +219,16 @@ class PreviewRecorder:
os.unlink(os.path.join(PREVIEW_CACHE_DIR, file))
continue
file_time = file.split("-")[1][: -(len(PREVIEW_FRAME_TYPE) + 1)]
try:
file_time = file.split("-")[-1][: -(len(PREVIEW_FRAME_TYPE) + 1)]
if not file_time:
if not file_time:
continue
ts = float(file_time)
except ValueError:
continue
ts = float(file_time)
if self.start_time == 0:
self.start_time = ts