mirror of
https://github.com/koreader/koreader.git
synced 2025-08-10 00:52:38 +00:00
feat: Adds progress bar to cloud storage downloads (#13650)
This commit is contained in:
@@ -162,13 +162,17 @@ function WebDavApi:listFolder(address, user, pass, folder_path, folder_mode)
|
||||
return webdav_list
|
||||
end
|
||||
|
||||
function WebDavApi:downloadFile(file_url, user, pass, local_path)
|
||||
function WebDavApi:downloadFile(file_url, user, pass, local_path, progress_callback)
|
||||
socketutil:set_timeout(socketutil.FILE_BLOCK_TIMEOUT, socketutil.FILE_TOTAL_TIMEOUT)
|
||||
logger.dbg("WebDavApi: downloading file: ", file_url)
|
||||
local code, headers, status = socket.skip(1, http.request{
|
||||
|
||||
local handle = ltn12.sink.file(io.open(local_path, "w"))
|
||||
handle = socketutil.chainSinkWithProgressCallback(handle, progress_callback)
|
||||
|
||||
local code, headers, status = socket.skip(1, http.request {
|
||||
url = file_url,
|
||||
method = "GET",
|
||||
sink = ltn12.sink.file(io.open(local_path, "w")),
|
||||
sink = handle,
|
||||
user = user,
|
||||
password = pass,
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user