use update ui for installer

This commit is contained in:
j 2016-01-21 14:02:26 +05:30
commit 72e5cbd0ec
5 changed files with 181 additions and 59 deletions

View file

@ -40,6 +40,13 @@ class Handler(SimpleHTTPServer.SimpleHTTPRequestHandler):
with open(path) as fd:
content = fd.read()
self.send_response(200, 'OK')
content_type = {
'html': 'text/html',
'png': 'image/png',
'svg': 'image/svg+xml',
'txt': 'text/plain',
}.get(path.split('.')[-1], 'txt')
self.send_header('Content-Type', content_type)
else:
self.send_response(404, 'not found')
content = '404 not found'
@ -68,33 +75,28 @@ class Install(Thread):
os.chdir(target)
release = self.get_release()
self.status["release"] = release
for module in release['modules']:
self.status["step"] = 'downloading %s' % module
self.status["progress"] = 0
self.status["size"] = 0
self.status["step"] = 'Downloading...'
self.status["progress"] = 0
for module in sorted(release['modules']):
package_tar = release['modules'][module]['name']
url = self.release_url.replace('release.json', package_tar)
self.download(url, package_tar)
self.status["step"] = 'extracting %s' % module
self.status["progress"] = 0
self.status["step"] = 'Installing...'
for module in sorted(release['modules']):
package_tar = release['modules'][module]['name']
tar = tarfile.open(package_tar)
tar.extractall()
tar.close()
os.unlink(package_tar)
os.symlink('openmedialibrary/ctl', 'ctl')
self.status["progress"] = 0
self.status["step"] = "setup"
os.system("./ctl setup")
self.status["progress"] = 1
makedirs('data')
with open('data/release.json', 'w') as fd:
json.dump(release, fd, indent=2)
self.status = {"installation finished. starting...": True}
self.status = {"relaunch": True}
os.system("./ctl start &")
time.sleep(1)
time.sleep(5)
self.httpd.shutdown()
def download(self, url, filename):
dirname = os.path.dirname(filename)
if dirname:
@ -118,7 +120,6 @@ class Install(Thread):
return data
if __name__ == '__main__':
if len(sys.argv) == 1:
target = os.path.expanduser("~/Library/Application Support/Open Media Library")