summaryrefslogtreecommitdiff
path: root/update_from_db.py
diff options
context:
space:
mode:
authorSmallJoker <st.rentsch@hotmail.com>2014-07-23 13:46:42 +0200
committerSmallJoker <st.rentsch@hotmail.com>2014-07-23 13:46:42 +0200
commitdc44a8805fc5e3d5c8a3b4464c377dbdbf4a7e68 (patch)
tree96a443c2e4783eb31af44e181cc4b57b0b2f0310 /update_from_db.py
parent597213a67d3e224ef0e5f8aabdb53861d8c4db77 (diff)
Update
Diffstat (limited to 'update_from_db.py')
-rwxr-xr-xupdate_from_db.py22
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