How could I get current active Subtitle File path value (or URI) accurately without guess?
If you don't have time, you should have gotten my question until this line.
A video may have multiple subtitle files (video.srt, video.eng.srt, video.arb.srt, video.frn.srt, ...). Also the user can load subtitles from a path other than the video's (e.g. if Video Path: "D:/Path/To/Video/Name.mp4" and Loaded Subtitle File Path: "D:/Different/Path/Another Name.srt"). We can guess/expect the Subtitle File path (e.g. Expected Subtitle File Path: "D:/Path/To/Video/Name.srt"). But this may go wrong if the user loaded subtitles from another directory and the subtitle file was of another name than the video's (e.g. Loaded Subtitle File Path: "D:/Different/Path/Another Name.srt").
I use this approach to expect the Subtitle File path:
Code: Select all
decoded_media_uri = vlc.strings.decode_uri(vlc.input.item():uri())
--get loaded video's uri (Value Example: file:///D:/Path/To/Video/Name.mp4)
directory_path, filename, file_ext = decoded_media_uri:match("^file:///(.+/)(.+)(%..+)$")
--assign loaded video's: directory_path, filename, file_ext
expected_srt_file_path = directory_path..filename..".srt"
--assign expected_srt_file_path (Value Example: D:/Path/To/Video/Name.srt)
How could I get current active Subtitle File path value accurately without guess? Maybe something similar to the way we get the loaded video's uri, we get the loaded subtitle's uri somehow I need to know.
Thanks in advance!