From 048496da427917056c3331e3482590e59955b685 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Thu, 5 Oct 2023 17:45:01 +0530 Subject: mpv: use media-title as key for http streams --- main.lua | 9 +++++---- server/subscene.lua | 4 ++-- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/main.lua b/main.lua index 097a53a..f89b8fd 100644 --- a/main.lua +++ b/main.lua @@ -56,14 +56,15 @@ local sub_setup = function () mkdir(out) path = mp.get_property_native('path') - name = util.string_vid_path_to_name(path) - out = out .. '/' .. name .. '.srt' + out = out .. '/' .. util.string_vid_path_to_name(path) .. '.srt' - if not path:find('https?://') then + if path:find('https?://') then + name = mp.get_property_native('media-title') + else rc = opensubtitles.search(path, out) end if not rc then - rc = subscene.search(path, out) + rc = subscene.search(path, out, name) end if rc then diff --git a/server/subscene.lua b/server/subscene.lua index 4c99e8a..8da1e63 100644 --- a/server/subscene.lua +++ b/server/subscene.lua @@ -160,10 +160,10 @@ local link_fetch = function (id) return link, rc end -local search = function (path, out) +local search = function (path, out, name) local title, id, link, rc, key - key = util.string_vid_path_to_name(path) + key = name or util.string_vid_path_to_name(path) title, rc = title_search(key) if not rc then return false -- cgit v1.2.3