This commit is contained in:
Kloadut 2013-02-10 20:32:15 +01:00
commit fed9e529fd

View file

@ -30,31 +30,12 @@ def app_updatelist(url=None):
try: info_fetch = urlopen(list_url)
except IOError: info_fetch = False
finally:
if info_fetch and (info_fetch.code == 200): info_dict = json.loads(str(info_fetch.read()))
if info_fetch and (info_fetch.code == 200): urlretrieve(list_url, app_path + str(infos['lastUpdate']) + '.json')
else: raise YunoHostError(1, _("List server connection failed"))
# Fetch manifests and icons
for appid, infos in info_dict.items():
if appid not in os.listdir(app_path):
os.mkdir(app_path + appid)
if str(infos['lastUpdate']) not in os.listdir(app_path + appid):
os.rmdir(app_path + appid)
os.mkdir(app_path + appid)
try: manifest_fetch = urlopen(infos['manifest'])
except IOError: manifest_fetch = False
finally:
if manifest_fetch and (manifest_fetch.code == 200): urlretrieve(infos['manifest'], app_path + appid + '/' + str(infos['lastUpdate']))
else: raise YunoHostError(1, appid + _(" manifest download failed"))
try: icon_fetch = urlopen(infos['icon'])
except IOError: icon_fetch = False
finally:
if icon_fetch and (icon_fetch.code == 200): urlretrieve(infos['icon'], app_path + appid + '/icon.png')
else: raise YunoHostError(1, appid + _(" icon download failed"))
return True
def app_list(args):
info_dict = json.loads(str(info_fetch.read()))
pass