mirror of
https://github.com/Rafostar/clapper.git
synced 2025-09-01 00:41:58 +02:00
Check if local subtitle file exists before loading it
Otherwise GStreamer will error out and playback will stop. Non-existing subtitle file is common on Flatpak when user tries to open/drop a file from a folder that container does not have access to.
This commit is contained in:
13
src/misc.js
13
src/misc.js
@@ -126,6 +126,19 @@ function parsePlaylistFiles(filesArray)
|
||||
return [filesArray, subs];
|
||||
}
|
||||
|
||||
function getFileFromLocalUri(uri)
|
||||
{
|
||||
const file = Gio.file_new_for_uri(uri);
|
||||
|
||||
if(!file.query_exists(null)) {
|
||||
debug(`file does not exist: ${file.get_path()}`, 'LEVEL_WARNING');
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
return file;
|
||||
}
|
||||
|
||||
function encodeHTML(text)
|
||||
{
|
||||
return text.replace(/&/g, '&')
|
||||
|
Reference in New Issue
Block a user