set status earlier

This commit is contained in:
j 2016-01-21 14:23:35 +05:30
commit 639a0bcd24
2 changed files with 6 additions and 4 deletions

View file

@ -59,7 +59,9 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
class Install(Thread):
release_url = "http://downloads.openmedialibrary.com/release.json"
status = {}
status = {
'step': 'Downloading...'
}
def __init__(self, target, httpd):
target = os.path.normpath(os.path.join(os.path.abspath(target)))
@ -73,9 +75,9 @@ class Install(Thread):
target = self.target
makedirs(target)
os.chdir(target)
self.status["step"] = 'Downloading...'
release = self.get_release()
self.status["release"] = release
self.status["step"] = 'Downloading...'
self.status["progress"] = 0
for module in sorted(release['modules']):
package_tar = release['modules'][module]['name']
@ -110,7 +112,6 @@ class Install(Thread):
while data:
if size:
available += len(data)
self.status["progress"] = available/size
f.write(data)
data = u.read(4096)