mirror of
https://github.com/minetest-mods/skinsdb.git
synced 2025-06-28 22:26:02 +02:00
Adds a filename split seperator setting that lets you choose between old style `_` and `.` because dot is the only char that isn´t allowed in playername but in texturenames. Default value is `_` to keep it compatible with older versions, while `.` offers a solution to fix #54.
This commit is contained in:
@ -1,5 +1,9 @@
|
||||
import sys, requests, base64
|
||||
|
||||
# filename seperator to use, either default "-" or ".". see skinsdb/textures/readme.txt
|
||||
#fsep = "_"
|
||||
fsep = "."
|
||||
|
||||
download_preview = ( len (sys.argv) > 1 and sys.argv[1] == "with_preview" )
|
||||
|
||||
|
||||
@ -24,7 +28,7 @@ for json in data["skins"]:
|
||||
|
||||
# Texture file
|
||||
raw_data = base64.b64decode(json["img"])
|
||||
file = open("../textures/character_" + id + ".png", "wb")
|
||||
file = open("../textures/character" + fsep + id + ".png", "wb")
|
||||
file.write(bytearray(raw_data))
|
||||
file.close()
|
||||
|
||||
@ -44,7 +48,7 @@ for json in data["skins"]:
|
||||
if r2.status_code == 200:
|
||||
# Preview file
|
||||
preview = r2.content
|
||||
file = open("../textures/character_" + id + "_preview.png", "wb")
|
||||
file = open("../textures/character_" + id + fsep + "preview.png", "wb")
|
||||
file.write(bytearray(preview))
|
||||
file.close()
|
||||
else:
|
||||
|
Reference in New Issue
Block a user