Escape file path properly
This commit is contained in:
parent
5e9c6229a4
commit
1100db8bf0
1 changed files with 1 additions and 5 deletions
|
@ -1,6 +1,5 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import os
|
|
||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
|
|
||||||
import gi
|
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:
|
def play(self, file_path: Path | str, position: int = 0, subtitle_track: int = -2) -> None:
|
||||||
"""Start playing a video file"""
|
"""Start playing a video file"""
|
||||||
|
|
||||||
if isinstance(file_path, Path):
|
self.playbin.set_property("uri", Gst.filename_to_uri(str(file_path)))
|
||||||
file_path = os.path.abspath(file_path)
|
|
||||||
|
|
||||||
self.playbin.set_property("uri", f"file://{file_path}")
|
|
||||||
|
|
||||||
if subtitle_track >= 0:
|
if subtitle_track >= 0:
|
||||||
flags = self.playbin.get_property("flags")
|
flags = self.playbin.get_property("flags")
|
||||||
|
|
Loading…
Reference in a new issue