1 В избранное 0 Ответвления 0

OSCHINA-MIRROR/li9chuan-jscomp

Клонировать/Скачать
compress.py 1.2 КБ
Копировать Редактировать Web IDE Исходные данные Просмотреть построчно История
0xcc Отправлено 19.11.2018 05:51 3391a97
# https://github.com/li9chuan/jscomp
import time;
import zlib;
import json;
import struct;
file_object = open('manifest.json', 'rb')
try:
all_the_text = file_object.read()
finally:
file_object.close()
json = json.loads(all_the_text)
#print(json["initial"])
#print(json["initial"][0].split('/'))
output = open('game.cfg', 'wb')
#buff = zlib.compress(all_the_text, zlib.Z_BEST_COMPRESSION)
#output.write( struct.pack('!L', len(buff)) )
#output.write( buff )
for url in json["initial"]:
if 'zlib' in url:
print(url+" ====> break")
continue
else:
print(url)
tf = open("./"+url, 'rb')
try:
file_txt = tf.read()
finally:
tf.close()
str1 = zlib.compress(file_txt, zlib.Z_BEST_COMPRESSION)
output.write( struct.pack('!L', len(str1)) )
output.write( str1 )
print(len(str1))
for url in json["game"]:
print(url)
tf = open("./"+url, 'rb')
try:
file_txt = tf.read()
finally:
tf.close()
str1 = zlib.compress(file_txt, zlib.Z_BEST_COMPRESSION)
output.write( struct.pack('!L', len(str1)) )
output.write( str1 )
print(len(str1))
output.write( struct.pack('!L', 0) )
output.close()
time.sleep(1);

Опубликовать ( 0 )

Вы можете оставить комментарий после Вход в систему

1
https://api.gitlife.ru/oschina-mirror/li9chuan-jscomp.git
git@api.gitlife.ru:oschina-mirror/li9chuan-jscomp.git
oschina-mirror
li9chuan-jscomp
li9chuan-jscomp
master