From 5f5adabdeec7f2bf0897ef81fbc7e04dfed4b015 Mon Sep 17 00:00:00 2001 From: sinanmohd Date: Sat, 7 Oct 2023 19:18:20 +0530 Subject: lib/util: init file_exists --- server/opensubtitles.lua | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) (limited to 'server') diff --git a/server/opensubtitles.lua b/server/opensubtitles.lua index 0bace8b..b797f44 100644 --- a/server/opensubtitles.lua +++ b/server/opensubtitles.lua @@ -134,11 +134,16 @@ local search_ohash = function (ohash) end end -local search = function (path, out) +local search = function (path, out, name) local ohash, link - ohash = util.opensubtitles_hash(path) - link = search_ohash(ohash) + if util.file_exists(path) then + ohash = util.opensubtitles_hash(path) + link = search_ohash(ohash) + else + name = name or util.string_vid_path_to_name(path) + end + if link then return curl.zip_link_to_file(link, nil, out, tries) end -- cgit v1.2.3