07-03-2016
|
1
|
Terra Branford
Join Date: Apr 2013
Location: Next to you
Posts: 3,284
|
I'm in the middle of doing something right now that requires me to use a Python script.
Does anyone know how to run the script? I have Python 2.7
here is the script:
PHP Code:
import struct, sys, zlib, os
def crc(filename): return zlib.crc32(filename) & 0xffffffff if len(sys.argv) < 2: print("Usage: python2 cachegen.py <path to saltysd/smash/>") quit() files = []
for root, directories, filenames in os.walk(sys.argv[1]): for filename in filenames: name = os.path.join(root,filename).replace(os.path.join(sys.argv[1], ''), "").lower().replace('\\', '/') print name.lower() + " " + hex(crc(name.lower())) files.append(name.lower())
#print filenames filecrcs = [] f = open(os.path.join(sys.argv[1], '') + "cache.bin", "wb") f.write(struct.pack('<L', len(files)))
for file in files: f.write(struct.pack('<L', crc(file)))
f.close() print("Complete!")
actually, nvm. it was so simple, i got it.
|
|
|