# -*- coding: utf-8 -*- import os.path import os import sys import hashlib import shutil import platform import re import json def CalcMD5(filepath): with open(filepath,'rb') as f: md5obj = hashlib.md5() md5obj.update(f.read()) hash = md5obj.hexdigest() f.close() return hash if __name__ == "__main__": buildNumber = sys.argv[1] obbPath = sys.argv[2] outpath = sys.argv[3] baseUrl="http://192.168.1.245/arpg/obb/" #obb信息写入obbinfo文件 obbJson={} obbJson["url"]=baseUrl + buildNumber + '/' + obbPath.split("/")[-1] obbJson["md5"]=CalcMD5(obbPath) obbJson["size"]=os.path.getsize(obbPath) js = json.dumps(obbJson, indent=4, sort_keys=True) obbfile=open(outpath+"/" +buildNumber+ '_obbinfo', 'wt') obbfile.writelines(js) obbfile.close()