def saveExport(self, _outFile): writer = PyArchive.FileWriter() writer.Open(_outFile, True) # 写入所有文件 writer.Write("audio#1.ogg", self.status.music) writer.Write("audio#2.ogg", self.status.accompaniment) writer.Write("app.asset", Util.fileToBytes('./template/Karaoke/app.asset')) writer.Write("app.lua", Util.fileToBytes('./template/Karaoke/app.lua')) writer.Write("config.lua", self.renderConfig()) writer.Write("preloads.json", Util.stringToBytes(json.dumps(self.status.preloads))) writer.Close()
def saveExport(self, _outFile): self.status.preloads[0]['count'] = len(self.status.photos) writer = PyArchive.FileWriter() writer.Open(_outFile, True) # 写入文件 idx = 0 for filename in self.status.binary.keys(): idx += 1 writer.Write('img#{0}.jpg'.format(idx), self.status.binary[filename]) writer.Write("app.asset", Util.fileToBytes('./template/PhotoAlbum/app.asset')) writer.Write("app.lua", Util.fileToBytes('./template/PhotoAlbum/app.lua')) writer.Write("config.lua", self.renderConfig()) writer.Write("preloads.json", Util.stringToBytes(json.dumps(self.status.preloads))) writer.Close()
def saveExport(self, _outFile): writer = PyArchive.FileWriter() writer.Open(_outFile, True) # 判断是否有朗诵音频 if 0 != len(self.status.audio): writer.Write("audio#1.ogg", self.status.audio) writer.Write("preloads.json", Util.stringToBytes(json.dumps(self.status.preloads))) else: writer.Write("preloads.json", Util.stringToBytes(json.dumps([]))) # 写入所有文件 writer.Write("app.asset", Util.fileToBytes('./template/Reciting/app.asset')) writer.Write("app.lua", Util.fileToBytes('./template/Reciting/app.lua')) writer.Write("config.lua", self.renderConfig()) writer.Close()