Settings: Filename Format Set

and small changes to follow PEP8 code style

change default README to Chinese
This commit is contained in:
2023-06-24 14:01:32 +08:00
parent feb68498dc
commit 91f568e18d
10 changed files with 132 additions and 81 deletions

View File

@@ -13,8 +13,8 @@ def clear():
os.system("clear")
def cls_stay(self, custom=""):
def cls_stay(self, custom="", *args, **kwargs):
"""保留版本号清除屏幕"""
clear()
print(f"{Fore.YELLOW}[{Fore.GREEN}NeteaseMusicLyricDownloader{Fore.YELLOW}] {Fore.LIGHTBLACK_EX}{self.version}")
print(Fore.LIGHTMAGENTA_EX+custom)
print(Fore.LIGHTMAGENTA_EX+custom, *args, **kwargs)

View File

@@ -90,7 +90,8 @@ def load_and_decrypt_from_ncm(file_path, target_dir, out_format) -> dict | str:
# media data
if meta_length:
output_path = os.path.join(target_dir, regular_filename(out_format % {"name": meta_data["musicName"], "artists": "".join(
output_path = os.path.join(target_dir, regular_filename(out_format % {"name": meta_data["musicName"],
"artists": "".join(
[x[0]+"," for x in meta_data["artist"]]
)[:-1]} + "." + meta_data["format"]))
else:

View File

@@ -1,7 +1,9 @@
"""该程序的自述信息,调用即输出"""
from modules.utils.clear_screen import clear
"""有关打印的函数"""
from colorama import Fore
from modules.utils.clear_screen import clear
from modules.utils.inputs import rinput
def print_info(self):
"""调用即输出,无返回值"""
@@ -25,6 +27,17 @@ def print_info(self):
def print_menu(menu: dict):
"""传入一个字典, 格式为 {"需要输入的字符": "功能描述", ...}"""
"""传入一个字典, 格式为 {"需要输入的字符": "功能描述", ...}
将会按照以下格式打印:
[字符1] 功能描述1
[字符2] 功能描述2
..."""
for k, v in menu.items():
print(f"{Fore.LIGHTBLUE_EX}[{k}] {Fore.LIGHTWHITE_EX}{v}")
print(f"{Fore.LIGHTBLUE_EX}[{k}] {Fore.RESET}{v}")
def input_menu(menu: dict):
"""传入一个字典, 格式为 {"需要输入的字符": "功能描述", ...}
在 print_menu 末尾添加'请选择: '字样并要求输入, 使用rinput获取输入"""
print_menu(menu)
return rinput("请选择: ")