From c31a459f3679c75e82e0242e0a3d3e81c4282790 Mon Sep 17 00:00:00 2001 From: FlintyLemming Date: Sat, 28 Feb 2026 11:05:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20fix(av1-transfer):=20catch=20Fil?= =?UTF-8?q?eNotFoundError=20in=20get=5Fduration=20when=20ffprobe=20is=20mi?= =?UTF-8?q?ssing?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 4.6 --- av1-transfer/main.py | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/av1-transfer/main.py b/av1-transfer/main.py index fe97877..32f5e79 100644 --- a/av1-transfer/main.py +++ b/av1-transfer/main.py @@ -75,19 +75,19 @@ def _set_proc_title(title: str) -> None: def get_duration(input_path): """用 ffprobe 获取视频时长(秒),失败返回 None""" - result = subprocess.run( - [ - "ffprobe", "-v", "error", - "-show_entries", "format=duration", - "-of", "default=noprint_wrappers=1:nokey=1", - str(input_path), - ], - capture_output=True, - text=True, - ) try: + result = subprocess.run( + [ + "ffprobe", "-v", "error", + "-show_entries", "format=duration", + "-of", "default=noprint_wrappers=1:nokey=1", + str(input_path), + ], + capture_output=True, + text=True, + ) return float(result.stdout.strip()) - except (ValueError, AttributeError): + except Exception: return None