def main(game, is_public): appName = game['appName'] channels = utils_config.getAllChannels(appName, is_public) utils_log.info("channels data: " + str(channels)) if channels is None or len(channels) == 0: print(u"没有任何可以打包的渠道") return for ch in channels: name = ch['name'] if ch['name'] == 'pyw': defchannel = ch elif ch['name'] == 'oppo': channel = ch game = {'appId': '52', 'appKey': '8c7f4751', 'appName': 'sample'} # channel = {'id':'17','name':'pyw','sdk':'pyw','suffix':'.pyw'} 朋友玩:17 应用宝:25 九九游:26 可游:27 六六九:28 华为:29 智游:31 UC:33 柠檬:34 utils_log.info("channel data: " + str(channel)) utils_log.info("defchannel data: " + str(defchannel)) baseApkPath = utils_file.getFullPath('games/' + game['appName'] + '/game.apk') utils_log.info("the base apk file is : %s", baseApkPath) core.pack(game, channel, defchannel, baseApkPath, is_public)
def start_bag(game, channel): #总调用打包 baseApkPath = file_utils.getFullPath('games/' + game + '/u8.apk') isPublic = True gamedata = u8_data_game(game) channeldata = u8_data_channel(game, channel) # print(gamedata) # print(channeldata) bag = core.pack(gamedata, channeldata, baseApkPath, isPublic) print(bag) return bag
def run(self): while True: if self.queue.empty(): break channel = self.queue.get() ret = core.pack(self.game, channel, self.sourcePath, self.isPublic) if ret: self.failNum = self.failNum + 1 else: self.sucNum = self.sucNum + 1 self.queue.task_done() log_utils.info("Thread-%s:sucNum:%s;failNum:%s",self.threadIndex,str(self.sucNum), str(self.failNum)) return
def main(game, isPublic, target): appName = game['appName'] channels = config_utils.getAllChannels(appName, isPublic) if channels is None or len(channels) == 0: print("没有任何可以打包的渠道") return 3 selected = [] if target == '*': selected = channels else: for t in target.split(','): t = t.strip() matchChannels = [c for c in channels if c['name'].lower() == t.lower()] if len(matchChannels) > 0: selected.append(matchChannels[0]) clen = len(selected) log_utils.info("now hava %s channels to package...", clen) baseApkPath = file_utils.getFullPath('games/'+game['appName']+'/u8.apk') log_utils.info("the base apk file is : %s", baseApkPath) if not os.path.exists(baseApkPath): log_utils.error('the base apk file is not exists, must named with u8.apk') return 2 sucNum = 0 failNum = 0 for channel in selected: ret = core.pack(game, channel, baseApkPath, isPublic) if ret: exit(1) failNum = failNum + 1 else: sucNum = sucNum + 1 log_utils.info("<< success num:%s; failed num:%s >>", sucNum, failNum) if failNum > 0: log_utils.error("<< all done with error >>") else: log_utils.info("<< all nice done >>") return 0
def packChannels(game, channels, baseApkPath, isPublic): clen = len(channels) log_utils.info("now hava %s channels to package...", clen) sucNum = 0 failNum = 0 for channel in channels: ret = core.pack(game, channel, baseApkPath, isPublic) if ret: failNum = failNum + 1 else: sucNum = sucNum + 1 log_utils.info("<< success num:%s; failed num:%s >>", sucNum, failNum) if failNum > 0: log_utils.error("<< all done with error >>") else: log_utils.info("<< all nice done >>")
def main(game, isPublic, isFullRes = False): print(u"**********当前配置的渠道号**********") print(u"\t渠道名 \t\t 渠道号 \t\t 渠道 \n") appName = game['appName'] channels = config_utils.getAllChannels(appName, isPublic) if channels is None or len(channels) == 0: print("没有任何可以打包的渠道") return for ch in channels: name = ch['name'] if len(name) <= 6: chStr = u"\t%s \t\t\t %s \t\t %s " % (ch['name'], ch['id'], ch['desc']) elif len(name) > 6 and len(name) <= 13: chStr = u"\t%s \t\t %s \t\t %s " % (ch['name'], ch['id'], ch['desc']) else: chStr = u"\t%s \t %s \t\t %s " % (ch['name'], ch['id'], ch['desc']) print(chStr) selected = [] while(True): sys.stdout.write(u"请选择需要打包的渠道(渠道名),全部输入*,多个用逗号分割:") sys.stdout.flush() target = raw_input() if target == '*': selected = channels else: for t in target.split(','): t = t.strip() matchChannels = [c for c in channels if c['name'].lower() == t.lower()] if len(matchChannels) > 0: selected.append(matchChannels[0]) if len(selected) == 0: print(u"\n无效的渠道名,请重新输入!!\n") else: break clen = len(selected) log_utils.info("now hava %s channels to package...", clen) baseApkPath = file_utils.getFullPath('games/'+game['appName']+'/u8.apk') log_utils.info("the base apk file is : %s", baseApkPath) if not os.path.exists(baseApkPath): log_utils.error('the base apk file is not exists, must named with u8.apk') return sucNum = 0 failNum = 0 for channel in selected: ret = core.pack(game, channel, baseApkPath, isPublic) if ret: failNum = failNum + 1 else: sucNum = sucNum + 1 log_utils.info("<< success num:%s; failed num:%s >>", sucNum, failNum) if failNum > 0: log_utils.error("<< all done with error >>") else: log_utils.info("<< all nice done >>")
def main(game, isPublic, channelName): appName = game['appName'] baseApkPath = file_utils.getFullPath('games/' + appName + '/u8.apk') log_utils.info("the base apk file is : %s", baseApkPath) if not os.path.exists(baseApkPath): log_utils.error( 'the base apk file is not exists, must named with u8.apk') return channels = config_utils.getAllChannels(appName, isPublic) if channels is None or len(channels) == 0: log_utils.info("没有任何可以打包的渠道") return if channelName is not None: if channelName == '*': packChannels(game, channels, baseApkPath, isPublic) return selectChannel = getChannelByName(channelName, channels) if selectChannel is None: log_utils.info("指定的渠道名不存在") return ret = core.pack(game, selectChannel, baseApkPath, isPublic) if ret: log_utils.error("<< all done with error >>") else: log_utils.info("<< all nice done >>") return print(u"################################################################") print(u"\t%-15s%-20s%-20s\n" % (u"渠道名", u"渠道号", u"渠道")) for ch in channels: print(u"\t%-20s%-20s%-20s" % (ch['name'], ch['id'], ch['desc'])) print("") selected = [] while (True): sys.stdout.write(u"请选择需要打包的渠道(渠道名),全部输入*,多个用逗号分割:") sys.stdout.flush() target = input() if target == '*': selected = channels else: for t in target.split(','): t = t.strip() matchChannels = [ c for c in channels if c['name'].lower() == t.lower() ] if len(matchChannels) > 0: selected.append(matchChannels[0]) if len(selected) == 0: print(u"\n无效的渠道名,请重新输入!!\n") else: break packChannels(game, selected, baseApkPath, isPublic)