diff options
author | sinanmohd <sinan@sinanmohd.com> | 2023-10-07 19:18:20 +0530 |
---|---|---|
committer | sinanmohd <sinan@sinanmohd.com> | 2023-10-07 19:18:20 +0530 |
commit | 5f5adabdeec7f2bf0897ef81fbc7e04dfed4b015 (patch) | |
tree | f408219d5ba3b46ba29efadea158405f76357be8 /server | |
parent | 048496da427917056c3331e3482590e59955b685 (diff) |
lib/util: init file_exists
Diffstat (limited to 'server')
-rw-r--r-- | server/opensubtitles.lua | 11 |
1 files changed, 8 insertions, 3 deletions
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 |