Retry get track to cache and mark reused cache files

This commit is contained in:
localhost_frssoft 2023-02-05 03:02:32 +03:00
parent 71ad1daf2b
commit 74b5f59684

View file

@ -32,10 +32,11 @@ function make_cache_track(url)
if false == file_exists(cache_path_file) then if false == file_exists(cache_path_file) then
createDir('cache/' .. host .. '/') createDir('cache/' .. host .. '/')
msg.verbose('Caching ' .. cache_path_file .. '') msg.verbose('Caching ' .. cache_path_file .. '')
os.execute('curl -s "' .. url .. '" -o "' .. cache_path_file .. '"') os.execute('curl -s --retry 3 "' .. url .. '" -o "' .. cache_path_file .. '"')
mp.set_property("stream-open-filename", cache_path_file) mp.set_property("stream-open-filename", cache_path_file)
else else
msg.verbose('Already cached ' .. cache_path_file .. '') msg.verbose('Already cached ' .. cache_path_file .. '')
os.execute('touch ' .. cache_path_file .. '')
mp.set_property("stream-open-filename", cache_path_file) mp.set_property("stream-open-filename", cache_path_file)
end end
end end