diff options
Diffstat (limited to 'update_from_db.py')
-rwxr-xr-x | update_from_db.py | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/update_from_db.py b/update_from_db.py index 193c87d..a943000 100755 --- a/update_from_db.py +++ b/update_from_db.py @@ -33,14 +33,26 @@ def addpage(page): f.write(base64.b64decode(s["img"])) f.close() f = open(metadir+"character_"+str(i)+".txt",'w') - f.write('name = "'+s["name"]+'",\n') - f.write('author = "'+s["author"]+'",\n') - f.write('comment = "'+s["license"]+'",\n') + f.write(s["name"] + '\n') + f.write(s["author"] + '\n') + f.write(s["license"]) + f.close() + try: + c.request("GET","/skins/1/"+str(s["id"])+".png") + r = c.getresponse() + except StandardError: + c.request("GET","/skins/1/"+str(s["id"])+".png") + r = c.getresponse() + if r.status != 200: + print("Error", r.status) + exit(r.status) + data = r.read() + f = open(skinsdir+"character_"+str(i)+"_preview.png",'wb') + f.write(data) f.close() i = i + 1 addpage(1) if pages > 1: for p in range(pages-1): addpage(p+2) -print("Skins have been updated. Please run ./generate_previews.sh") - +print("Skins have been updated!")
\ No newline at end of file |