Escape file path properly

This commit is contained in:
Jan Hamal Dvořák 2025-03-09 18:07:06 +01:00
parent 5e9c6229a4
commit 1100db8bf0

View file

@ -1,6 +1,5 @@
from __future__ import annotations
import os
from pathlib import Path
import gi
@ -45,10 +44,7 @@ class VideoPlayer(GObject.Object):
def play(self, file_path: Path | str, position: int = 0, subtitle_track: int = -2) -> None:
"""Start playing a video file"""
if isinstance(file_path, Path):
file_path = os.path.abspath(file_path)
self.playbin.set_property("uri", f"file://{file_path}")
self.playbin.set_property("uri", Gst.filename_to_uri(str(file_path)))
if subtitle_track >= 0:
flags = self.playbin.get_property("flags")