2022-04-02 22:50:52 +08:00
|
|
|
#!/usr/bin/env python3
|
2023-04-03 22:29:25 +08:00
|
|
|
# ↑ For Linux & macOS to run this program directly if the user currently installed python and third-party packages.
|
2022-04-02 22:50:52 +08:00
|
|
|
# -*- coding: utf-8 -*-
|
2022-07-17 18:55:24 +08:00
|
|
|
# author: David-123
|
2022-04-02 22:50:52 +08:00
|
|
|
|
2023-05-07 01:59:03 +08:00
|
|
|
from sys import exit
|
|
|
|
|
|
|
|
from colorama import init
|
2022-04-02 22:50:52 +08:00
|
|
|
|
2023-04-04 19:58:02 +08:00
|
|
|
from modules.utils.inputs import rinput
|
2023-06-22 01:36:23 +08:00
|
|
|
from modules.utils.prints import print_info, print_menu
|
2023-05-07 01:59:03 +08:00
|
|
|
from modules.functions.mainly.multi_download import mdl
|
|
|
|
from modules.functions.mainly.one_download import download_one_lyric
|
2023-04-04 19:58:02 +08:00
|
|
|
from modules.submenus.settings import settings_menu
|
2023-05-07 01:59:03 +08:00
|
|
|
from modules.functions.settings.save_load_settings import load_settings
|
|
|
|
from modules.utils.clear_screen import cls_stay
|
|
|
|
from modules.functions.mainly.load_file_song import get_lyric_from_folder
|
2022-04-02 22:50:52 +08:00
|
|
|
|
|
|
|
|
|
|
|
class MainProcess(object):
|
2022-07-17 18:55:24 +08:00
|
|
|
def __init__(self): # 项目初始化
|
2022-04-02 22:50:52 +08:00
|
|
|
self.settings = load_settings()
|
2023-06-22 01:55:41 +08:00
|
|
|
self.version = "1.1.1"
|
2022-04-02 22:50:52 +08:00
|
|
|
|
|
|
|
def mainloop(self):
|
|
|
|
"""程序主循环"""
|
|
|
|
while True:
|
2023-05-07 01:59:03 +08:00
|
|
|
cls_stay(self, "[程序主菜单]")
|
2023-06-22 01:36:23 +08:00
|
|
|
print_menu({
|
|
|
|
"0": "退出程序",
|
|
|
|
"1": "单个歌曲的歌词下载",
|
|
|
|
"2": "多个歌曲的歌词下载",
|
|
|
|
"3": "从网易云下载的歌曲中获取歌词",
|
|
|
|
"s": "进入设置",
|
|
|
|
"i": "程序信息",
|
|
|
|
})
|
2022-04-02 22:50:52 +08:00
|
|
|
r = rinput("请选择:")
|
|
|
|
|
|
|
|
if r == "1":
|
2023-04-04 19:58:02 +08:00
|
|
|
download_one_lyric(self)
|
2022-04-02 22:50:52 +08:00
|
|
|
elif r == "2":
|
2023-04-04 19:58:02 +08:00
|
|
|
mdl(self)
|
2022-07-20 13:16:42 +08:00
|
|
|
elif r == "3":
|
2023-04-04 19:58:02 +08:00
|
|
|
get_lyric_from_folder(self)
|
2022-04-02 22:50:52 +08:00
|
|
|
elif r == "0":
|
2022-07-17 18:55:24 +08:00
|
|
|
exit(0)
|
2022-04-02 22:50:52 +08:00
|
|
|
elif r == "i":
|
|
|
|
print_info(self)
|
|
|
|
elif r == "s":
|
|
|
|
settings_menu(self)
|
|
|
|
else:
|
|
|
|
input("请输入正确的选项\n按回车键继续...")
|
|
|
|
|
|
|
|
|
|
|
|
if __name__ == "__main__":
|
2023-05-07 01:59:03 +08:00
|
|
|
init(autoreset=True)
|
2022-04-02 22:50:52 +08:00
|
|
|
app = MainProcess()
|
2022-07-20 13:16:42 +08:00
|
|
|
try:
|
|
|
|
app.mainloop()
|
|
|
|
except KeyboardInterrupt:
|
|
|
|
exit(-1)
|