62 end |
62 end |
63 |
63 |
64 function progress(batch) |
64 function progress(batch) |
65 local progress = {}; |
65 local progress = {}; |
66 for url, request in pairs(batch.urls) do |
66 for url, request in pairs(batch.urls) do |
67 local p = {}; |
67 if request ~= true then |
68 p.bytes_downloaded = request.havebodylength; |
68 local p = {}; |
69 p.bytes_total = request.bodylength; |
69 p.bytes_downloaded = request.havebodylength; |
70 if p.bytes_total then |
70 p.bytes_total = request.bodylength; |
71 p.percent = 100/(p.bytes_total/p.bytes_downloaded); |
71 if p.bytes_total then |
|
72 p.percent = 100/(p.bytes_total/p.bytes_downloaded); |
|
73 end |
|
74 progress[url] = p; |
72 end |
75 end |
73 progress[url] = p; |
|
74 end |
76 end |
75 return progress; |
77 return progress; |
76 end |
78 end |
77 |
79 |
78 function new(callback, urls) |
80 function new(callback, urls) |