diff --git a/.travis.yml b/.travis.yml index 20bc406..feb846e 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,21 +3,25 @@ language: python python: 3.7 sudo: required +cache: + - bundler + - pip + branches: except: - travis-dev-build before_install: -- export TZ=Asia/Shanghai -- mkdir dist -p -- sudo apt-get update -q + - export TZ=Asia/Shanghai + - mkdir dist -p + - sudo apt-get update -q install: -- sudo apt-get install qt5-default qttools5-dev-tools -y -q + - sudo apt-get install qt5-default qttools5-dev-tools -y -q script: -- python3 maker.py -- rm dist/* + - python3 maker.py + - rm dist/* before_deploy: - git tag -f travis-dev-build @@ -40,4 +44,7 @@ deploy: overwrite: true target_commitish: $TRAVIS_COMMIT on: - repo: jitingcn/TS3-Translation_zh-CN \ No newline at end of file + repo: jitingcn/TS3-Translation_zh-CN + +after_deploy: + - python3 maker.py 1 diff --git a/maker.py b/maker.py index 45f2d51..2d8ebfc 100644 --- a/maker.py +++ b/maker.py @@ -55,15 +55,22 @@ def make_release(): def send_progress(done, total): + percentage = round(done*100/total, 2) + output = f"测试推送:当前进度:\n{done}/{total}\n{percentage}%" + print(output) + try: + telegram_push(output) + print("\n推送完毕\n") + except Exception as err: + print(f"\n{err}\n推送失败\n") + + +def telegram_push(string): + querystring = parse.urlencode({"text": string.encode('utf-8')}) tg_api = os.getenv('TG_API') group_id = os.getenv('TG_GROUP_ID') url = f"https://api.telegram.org/bot{tg_api}/sendMessage?chat_id={group_id}&" - percentage = round(done*100/total, 2) - output = f"当前进度:\n{done}/{total}\n{percentage}%".encode("utf-8") - querystring = parse.urlencode({"text": output}) request.urlopen(url + querystring) - print(output.decode("utf-8")) - print("进度消息推送完毕\n") def make_package(release_list): @@ -72,7 +79,7 @@ def make_package(release_list): with open(ini, "w", encoding="utf-8") as f: package_info = [f"Name = TeamSpeak 3 简体中文汉化包 软件版本:{target_version}", "Type = Translation", - "Author = 寂听", + "Author = 寂听 & EdisonJwa", f"Version = {timestamp}", "Platforms = ", 'Description = 源代码: https://github.com/jitingcn/TS3-Translation_zh-CN'] @@ -84,11 +91,15 @@ def make_package(release_list): release.write(ini, "package.ini") for i in release_list: release.write(dist+i, f"translations/{i}") - print("Complete.") + print("构建成功") if __name__ == '__main__': - print("Making .qm translations file ...") - release_file_list = make_release() - print("Making .ts3_translation release package ...") - make_package(release_file_list) + if len(sys.argv) <= 1: + print("Making .qm translations file ...") + release_file_list = make_release() + print("Making .ts3_translation release package ...") + make_package(release_file_list) + else: + if sys.argv[1] == "1": + telegram_push("部署成功") diff --git a/src/lagos_zh.ts b/src/lagos_zh.ts index cd95252..d74b4a1 100644 --- a/src/lagos_zh.ts +++ b/src/lagos_zh.ts @@ -22,7 +22,7 @@ PLACEHOLDER Translators can add their names, copyright notice or links here. If the text stays "PLACEHOLDER", the label will be hidden. - <b>简体中文化 By:</b> <a href="http://blog.jtcat.com">寂听</a><br>由于本人水平有限,欢迎到<a href="https://github.com/jitingcn/TS3-Translation_zh-CN">GitHub项目主页</a>提出修改意见。<br>感谢所有参与项目的同学 + <b>简体中文化 By:</b> <a href="http://blog.jtcat.com/">寂听</a> & <a href="https://www.wevg.org/">EdisonJwa</a><br>如有任何疑问,欢迎到<a href="https://github.com/jitingcn/TS3-Translation_zh-CN">GitHub项目主页</a>提出建议或修改意见。<br>感谢所有提供帮助的同学 Copyright