mirror of
https://github.com/sys4-fr/server-nalc.git
synced 2025-01-26 01:30:29 +01:00
added python script to delete skins removed when updatedb readd
-simply write int number of removed skin in removed_skins.txt (1 by line)
This commit is contained in:
parent
d9785c5476
commit
d042026d0d
42
mods/u_skins/purge_skins.py
Executable file
42
mods/u_skins/purge_skins.py
Executable file
@ -0,0 +1,42 @@
|
|||||||
|
#!/usr/bin/env python
|
||||||
|
# -*- coding: UTF-8 -*-
|
||||||
|
|
||||||
|
import sys, os
|
||||||
|
|
||||||
|
# if used on windows ??
|
||||||
|
# use os.path.join() -> path sep win "\" or linux "/"
|
||||||
|
p_textures = os.path.join("u_skins", "textures")
|
||||||
|
p_meta = os.path.join("u_skins", "meta")
|
||||||
|
|
||||||
|
try:
|
||||||
|
f = open("removed_skins.txt", "r")
|
||||||
|
skins_exclued = f.readlines()
|
||||||
|
except IOError as err:
|
||||||
|
sys.stderr.write("%s\n" % err)
|
||||||
|
sys.exit(1)
|
||||||
|
else:
|
||||||
|
f.close()
|
||||||
|
|
||||||
|
print("il y a %d skins exclus." % len(skins_exclued))
|
||||||
|
|
||||||
|
for skin in skins_exclued:
|
||||||
|
# if not int value, ignore
|
||||||
|
try:
|
||||||
|
skin = "character_%s" % int(skin.strip())
|
||||||
|
except ValueError as err:
|
||||||
|
sys.stderr.write("%s\n" % err)
|
||||||
|
continue
|
||||||
|
# for texture, preview and meta files
|
||||||
|
for f_skin in ( os.path.join(p_textures,"%s.png" % skin),
|
||||||
|
os.path.join(p_textures,"%s_preview.png" % skin),
|
||||||
|
os.path.join(p_meta, "%s.txt" % skin) ):
|
||||||
|
if os.path.exists(f_skin):
|
||||||
|
try:
|
||||||
|
os.remove(f_skin)
|
||||||
|
except exception as err:
|
||||||
|
print(err)
|
||||||
|
pass
|
||||||
|
else:
|
||||||
|
print('skin "%s" effacé' % f_skin)
|
||||||
|
|
||||||
|
sys.exit(0)
|
12
mods/u_skins/removed_skins.txt
Normal file
12
mods/u_skins/removed_skins.txt
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
63
|
||||||
|
68
|
||||||
|
85
|
||||||
|
89
|
||||||
|
93
|
||||||
|
160
|
||||||
|
231
|
||||||
|
303
|
||||||
|
348
|
||||||
|
353
|
||||||
|
354
|
||||||
|
375
|
Loading…
Reference in New Issue
Block a user