diff options
| author | sinanmohd <sinan@sinanmohd.com> | 2023-10-01 20:00:12 +0530 | 
|---|---|---|
| committer | sinanmohd <sinan@sinanmohd.com> | 2023-10-01 20:00:12 +0530 | 
| commit | 994715046cedee5b9ab4f61a4112a2c73d506960 (patch) | |
| tree | 59d955219f3e28bb8287bc1b024a3bffe89f138e /server/opensubtitles.lua | |
| parent | fee405edd055656dd63690e03a0d3e1fc0e96b4e (diff) | |
curl: sub_fetch -> curl.zip_to_local_file
Diffstat (limited to 'server/opensubtitles.lua')
| -rw-r--r-- | server/opensubtitles.lua | 21 | 
1 files changed, 1 insertions, 20 deletions
| diff --git a/server/opensubtitles.lua b/server/opensubtitles.lua index 9a5def4..a9f2199 100644 --- a/server/opensubtitles.lua +++ b/server/opensubtitles.lua @@ -134,32 +134,13 @@ local search_ohash = function (ohash)  	end  end -local sub_fetch = function(link, out) -	local tries, hcode, zip, zcode - -	tries = 0 -	zip = os.tmpname() - -	repeat -		_, hcode = curl.get(link, nil, '-o ' .. zip) -		tries = tries + 1 -	until hcode == 200 or tries > retries - -	if hcode == 200 then -		zcode = util.zip_ext_first(zip, out) -	end -	os.remove(zip) - -	return (hcode == 200) and zcode -end -  local search = function (path, out)  	local ohash, link  	ohash = util.opensubtitles_hash(path)  	link = search_ohash(ohash)  	if link then -		return sub_fetch(link, out) +		return curl.zip_to_local_file(link, nil, out, retries)  	end  end | 
