Convenient ways of opening external subtitles

Play video with external subtiles by:
* selecting and opening both video+subs from file chooser/manager
* dropping subtitles file on player window
* opening subtiles from file chooser/manager while video plays
* send their file path/uri to player via WebSocket message
This commit is contained in:
Rafał Dzięgiel
2021-04-07 13:52:51 +02:00
parent 28d8986072
commit b15b94fc90
7 changed files with 92 additions and 86 deletions

View File

@@ -1,4 +1,4 @@
const { Gdk, GLib, GObject, Gst, GstClapper, Gtk } = imports.gi;
const { Gdk, Gio, GLib, GObject, Gst, GstClapper, Gtk } = imports.gi;
const { Controls } = imports.src.controls;
const Debug = imports.src.debug;
const Dialogs = imports.src.dialogs;
@@ -907,15 +907,17 @@ class ClapperWidget extends Gtk.Grid
_onDataDrop(dropTarget, value, x, y)
{
const playlist = value.split(/\r?\n/).filter(uri => {
const files = value.split(/\r?\n/).filter(uri => {
return Gst.uri_is_valid(uri);
});
if(!playlist.length)
if(!files.length)
return false;
this.player.set_playlist(playlist);
this.root.application.activate();
for(let index in files)
files[index] = Gio.File.new_for_uri(files[index]);
this.root.application.open(files, "");
return true;
}