From fee405edd055656dd63690e03a0d3e1fc0e96b4e Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sun, 1 Oct 2023 16:31:30 +0530 Subject: server: init opensubtitles --- main.lua | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'main.lua') diff --git a/main.lua b/main.lua index f0ddf70..975f96c 100644 --- a/main.lua +++ b/main.lua @@ -1,6 +1,7 @@ local mutil = require 'mp.utils' local util = require 'lib/util' local subscene = require 'server/subscene' +local opensubtitles = require 'server/opensubtitles' local mkdir = function (path) local info = mutil.file_info(path) @@ -41,7 +42,7 @@ local sub_needed = function () end local sub_setup = function () - local out, name, path + local out, name, path, rc mp.osd_message('fetching subtitle') @@ -58,8 +59,16 @@ local sub_setup = function () name = util.string_vid_path_to_name(path) out = out .. '/' .. name .. '.srt' - if subscene.search(path, out) then + if not path:find('https?://') then + rc = opensubtitles.search(path, out) + end + if not rc then + rc = subscene.search(path, out) + end + + if rc then mp.commandv('rescan_external_files') + mp.set_property('sid', 1) mp.osd_message('fetch success') else mp.osd_message('fetch failure') -- cgit v1.2.3