From 3178303b0a0632fb00db1d9dee3eca6fe691a12a Mon Sep 17 00:00:00 2001 From: ikun0014 Date: Sat, 19 Oct 2024 11:34:20 +0800 Subject: [PATCH] =?UTF-8?q?[release]ui:=20=E7=A7=BB=E9=99=A4=E6=89=80?= =?UTF-8?q?=E6=9C=89Emoji=EF=BC=9B=E4=BF=AE=E6=94=B9=E6=97=A5=E5=BF=97?= =?UTF-8?q?=E6=A0=BC=E5=BC=8F=E7=9C=8B=E8=B5=B7=E6=9D=A5=E6=9B=B4Print?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- common/check.py | 2 +- common/checkcn.py | 2 +- common/config.py | 4 ++-- common/dkey_merge.py | 2 +- common/get_manifest_info.py | 2 +- common/get_steam_path.py | 2 +- common/init_text.py | 27 +++++++++++++-------------- common/log.py | 2 +- common/main_func.py | 2 +- common/manifest_down.py | 2 +- common/migration.py | 2 +- common/st_unlock.py | 2 +- main.py | 6 +++--- 13 files changed, 28 insertions(+), 29 deletions(-) diff --git a/common/check.py b/common/check.py index 44af418..4145a2e 100644 --- a/common/check.py +++ b/common/check.py @@ -24,7 +24,7 @@ async def check_github_api_rate_limit(headers, session): log.error('Github请求数检查失败, 网络错误') except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except ClientError as e: log.error(f'检查Github API 请求数失败,{stack_error(e)}') except ConnectionTimeoutError as e: diff --git a/common/checkcn.py b/common/checkcn.py index 8feab52..a5992e9 100644 --- a/common/checkcn.py +++ b/common/checkcn.py @@ -18,7 +18,7 @@ def checkcn(): return True except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except requests.RequestException as e: os.environ['IS_CN'] = 'yes' log.warning('检查服务器位置失败,已忽略,自动认为你在中国大陆') diff --git a/common/config.py b/common/config.py index b7c0436..2f1a899 100644 --- a/common/config.py +++ b/common/config.py @@ -20,7 +20,7 @@ async def gen_config_file(): log.info('🖱️ 程序可能为第一次启动或配置重置,请填写配置文件后重新启动程序') except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f'配置文件生成失败,{stack_error(e)}') @@ -35,7 +35,7 @@ async def load_config(): config = json.loads(await f.read()) return config except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f"配置文件加载失败,原因: {stack_error(e)},重置配置文件中...") os.remove("./config.json") diff --git a/common/dkey_merge.py b/common/dkey_merge.py index e3ed544..5c48163 100644 --- a/common/dkey_merge.py +++ b/common/dkey_merge.py @@ -35,7 +35,7 @@ async def depotkey_merge(config_path: Path, depots_config: dict) -> bool: return True except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: async with lock: log.error(f'合并失败, 原因: {e}') diff --git a/common/get_manifest_info.py b/common/get_manifest_info.py index 5baa5af..1191232 100644 --- a/common/get_manifest_info.py +++ b/common/get_manifest_info.py @@ -37,7 +37,7 @@ async def get_manifest(sha: str, path: str, steam_path: Path, repo: str, session ] except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f'处理失败: {path} - {stack_error(e)}') raise diff --git a/common/get_steam_path.py b/common/get_steam_path.py index 82dc101..98794ab 100644 --- a/common/get_steam_path.py +++ b/common/get_steam_path.py @@ -13,7 +13,7 @@ def get_steam_path() -> Path: custom_steam_path = config.get("Custom_Steam_Path", "").strip() return Path(custom_steam_path) if custom_steam_path else steam_path except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f'Steam路径获取失败, {stack_error(e)}, 请检查是否正确安装Steam') os.system('pause') diff --git a/common/init_text.py b/common/init_text.py index 43f058f..8d1d269 100644 --- a/common/init_text.py +++ b/common/init_text.py @@ -6,20 +6,19 @@ from .log import log def init(): banner_lines = [ - f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} _____ __ _ _____ _ _ _____ __ __ {Style.RESET_ALL}", - f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} / _ \\ | \\ | | | ____| | | / / | ____| \\ \\ / /{Style.RESET_ALL}", - f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} | | | | | \\| | | |__ | |/ / | |__ \\ \\/ /{Style.RESET_ALL}", - f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} | | | | | |\\ | | __| | |\\ \\ | __| \\ / {Style.RESET_ALL}", - f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} | |_| | | | \\ | | |___ | | \\ \\ | |___ / /{Style.RESET_ALL}", - f"{Fore.GREEN}{Back.BLACK}{Style.BRIGHT} \\_____/ |_| \\_| |_____| |_| \\_\\ |_____| /_/{Style.RESET_ALL}", + f" _____ __ _ _____ _ _ _____ __ __ ", + f" / _ \\ | \\ | | | ____| | | / / | ____| \\ \\ / /", + f" | | | | | \\| | | |__ | |/ / | |__ \\ \\/ /", + f" | | | | | |\\ | | __| | |\\ \\ | __| \\ / ", + f" | |_| | | | \\ | | |___ | | \\ \\ | |___ / /", + f" \\_____/ |_| \\_| |_____| |_| \\_\\ |_____| /_/", ] for line in banner_lines: - print(line) + log.info(line) - log.info(f'作者: {Fore.RED}{Back.BLACK}{Style.BRIGHT}ikun0014{Style.RESET_ALL}') - log.info(f'{Fore.RED}{Back.BLACK}{Style.BRIGHT}本项目采用GNU General Public License v3开源许可证,请勿用于商业用途{Style.RESET_ALL}') - log.info('版本: 1.3.0') - log.info(f'{Fore.RED}{Back.BLACK}{Style.BRIGHT}项目Github仓库: https://github.com/ikunshare/Onekey{Style.RESET_ALL}') - log.info('官网: ikunshare.com') - log.warning('本项目完全开源免费, 如果你在淘宝, QQ群内通过购买方式获得, 赶紧回去骂商家死全家\n交流群组:\n https://t.me/ikunshare_qun') - log.warning('如果本项目中的Emoji(即表情包)无法正常显示, 请使用支持Emoji的终端(例如Windows Terminal)') + log.info(f'作者: ikun0014') + log.warning(f'本项目采用GNU General Public License v3开源许可证,请勿用于商业用途') + log.info(f'版本: 1.3.0') + log.info(f'项目Github仓库: https://github.com/ikunshare/Onekey') + log.info(f'官网: ikunshare.com') + log.warning(f'本项目完全开源免费, 如果你在淘宝, QQ群内通过购买方式获得, 赶紧回去骂商家死全家\n 交流群组:\n https://t.me/ikunshare_qun') \ No newline at end of file diff --git a/common/log.py b/common/log.py index fbe93a2..621b5f0 100644 --- a/common/log.py +++ b/common/log.py @@ -1,7 +1,7 @@ import logging import colorlog -LOG_FORMAT = '%(log_color)s[%(name)s][%(levelname)s]%(message)s' +LOG_FORMAT = '%(log_color)s%(message)s' LOG_COLORS = { 'INFO': 'cyan', 'WARNING': 'yellow', diff --git a/common/main_func.py b/common/main_func.py index f98d411..094eac2 100644 --- a/common/main_func.py +++ b/common/main_func.py @@ -21,7 +21,7 @@ async def fetch_branch_info(session, url, headers): async with session.get(url, headers=headers, ssl=False) as response: return await response.json() except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f'获取信息失败: {stack_error(e)}') return None diff --git a/common/manifest_down.py b/common/manifest_down.py index a599861..335fe72 100644 --- a/common/manifest_down.py +++ b/common/manifest_down.py @@ -35,7 +35,7 @@ async def get(sha: str, path: str, repo: str, session, chunk_size: int = 1024) - else: log.error(f'获取失败: {path} - 状态码: {response.status}') except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except ClientError as e: log.error(f'获取失败: {path} - 连接错误: {str(e)}') except ConnectionTimeoutError as e: diff --git a/common/migration.py b/common/migration.py index 652534b..6dccfe9 100644 --- a/common/migration.py +++ b/common/migration.py @@ -30,7 +30,7 @@ async def download_setup_file(session) -> None: else: log.error('网络错误,无法下载安装程序') except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f'下载失败: {e}') except ConnectionTimeoutError as e: diff --git a/common/st_unlock.py b/common/st_unlock.py index c56878b..3ee19d3 100644 --- a/common/st_unlock.py +++ b/common/st_unlock.py @@ -33,7 +33,7 @@ async def stool_add(depot_data: list, app_id: str) -> bool: log.info('处理完成') except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f'处理过程出现错误: {e}') return False diff --git a/main.py b/main.py index 6641240..ccd3e11 100644 --- a/main.py +++ b/main.py @@ -34,7 +34,7 @@ async def main_loop(): app_id = prompt_app_id() await main(app_id, repos) except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except EOFError: break @@ -43,7 +43,7 @@ async def run(): log.info('App ID可以在SteamDB或Steam商店链接页面查看') await main_loop() except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except Exception as e: log.error(f'发生错误: {stack_error(e)}, 将在5秒后退出') await asyncio.sleep(5) @@ -52,6 +52,6 @@ if __name__ == '__main__': try: asyncio.run(run()) except KeyboardInterrupt: - log.info("程序已退出") + log.info("\n 程序已退出") except SystemExit: sys.exit()