From a69a350b20c9013054df0fcd5d83e187131a2988 Mon Sep 17 00:00:00 2001 From: alastair-swan Date: Sun, 1 Dec 2024 13:58:50 -0800 Subject: [PATCH] added support for PurePath objects for defining source file. --- ffprobe/ffprobe.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ffprobe/ffprobe.py b/ffprobe/ffprobe.py index f1eb3dc..e7a4639 100644 --- a/ffprobe/ffprobe.py +++ b/ffprobe/ffprobe.py @@ -8,6 +8,7 @@ import platform import re import subprocess +from pathlib import Path from ffprobe.exceptions import FFProbeError @@ -31,7 +32,10 @@ def __init__(self, path_to_video): if platform.system() == 'Windows': cmd = ["ffprobe", "-show_streams", self.path_to_video] else: - cmd = ["ffprobe -show_streams " + pipes.quote(self.path_to_video)] + if isinstance(self.path_to_video, Path): + cmd = ["ffprobe -show_streams " + self.path_to_video.as_posix()] + else: + cmd = ["ffprobe -show_streams " + pipes.quote(self.path_to_video)] p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)