From b5dbccef85d2393b047b1420b78c480a7103ce7e Mon Sep 17 00:00:00 2001 From: Dylan De Faoite Date: Mon, 27 Apr 2026 23:16:23 +0100 Subject: [PATCH] fix(core): no existence validation of ts files --- rewind/core.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rewind/core.py b/rewind/core.py index b73a69b..911a53a 100644 --- a/rewind/core.py +++ b/rewind/core.py @@ -97,7 +97,7 @@ get_duration() is used as little as possible since it is slow. end_timestamp of a file is the start time of the next file. """ def _get_ts_files(start_timestamp: float, end_timestamp: float) -> tuple[list[str], float, float]: - ts_files = load_state()["files"] + ts_files = [f for f in load_state()["files"] if os.path.exists(f["path"])] selected_files = [] start_offset = 0.0 end_offset = 0.0 @@ -184,10 +184,11 @@ def get_duration(file_path: str) -> float: "format=duration", "-of", "default=noprint_wrappers=1:nokey=1", file_path], stdout=subprocess.PIPE, - stderr=subprocess.STDOUT + stderr=subprocess.PIPE, + text=True, ) if result.returncode != 0: raise RuntimeError(f"ffprobe failed for file {file_path}") - return float(result.stdout) \ No newline at end of file + return float(result.stdout.strip()) \ No newline at end of file