NeteaseMusicLyricDownloader/main.py

54 lines
1.7 KiB
Python
Raw Permalink Normal View History

2022-04-02 22:50:52 +08:00
#!/usr/bin/env python3
# ↑ 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 -*-
# author: David-123
2022-04-02 22:50:52 +08:00
from modules.raw_input import rinput
from modules.information import print_info
from modules.multi_download import mdl
from modules.one_download import download_one_lyric
from modules.settings import settings_menu
from modules.save_load_settings import load_settings
from modules.clear_screen import clear
2022-08-13 03:08:16 +08:00
from modules.load_file_song import get_lyric_from_folder
2022-04-02 22:50:52 +08:00
class MainProcess(object):
def __init__(self): # 项目初始化
2022-04-02 22:50:52 +08:00
self.settings = load_settings()
2022-08-13 03:08:16 +08:00
self.version = "1.0"
2022-04-02 22:50:52 +08:00
def mainloop(self):
"""程序主循环"""
while True:
clear()
2022-08-13 03:08:16 +08:00
print(f"[NeteaseMusicLyricDownloader] {self.version}\n"
2022-04-02 22:50:52 +08:00
"[程序主菜单]\n"
"[0] 退出程序\n[1] 单个歌曲的歌词下载\n[2] 多个歌曲的歌词下载\n[3] 从网易云下载的歌曲中获取歌词"
"\n[s] 进入设置\n[i] 程序信息")
2022-04-02 22:50:52 +08:00
r = rinput("请选择:")
if r == "1":
download_one_lyric(self.settings.lyric_path)
elif r == "2":
mdl(self.settings.lyric_path)
elif r == "3":
get_lyric_from_folder(self.settings.lyric_path)
2022-04-02 22:50:52 +08:00
elif r == "0":
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__":
app = MainProcess()
try:
app.mainloop()
except KeyboardInterrupt:
exit(-1)