update 2023/2/11 bug fixed

This commit is contained in:
bgArray 2023-02-11 23:23:05 +08:00
parent 64deb81d65
commit 82328efaaf
4 changed files with 34 additions and 25 deletions

3
.gitignore vendored
View File

@ -146,3 +146,6 @@ dmypy.json
# Cython debug symbols # Cython debug symbols
cython_debug/ cython_debug/
# Pycharm
.idea/

View File

@ -24,10 +24,10 @@ import sys
print("小贴不妨试试Mid-BDX转换网页在线的多功能Midi转换器") print("小贴不妨试试Mid-BDX转换网页在线的多功能Midi转换器")
print("https://dislink.github.io/midi2bdx/") print("https://dislink.github.io/midi2bdx/")
import Musicreater import Musicreater
from utils.io import * # 这一句可以不要因为lang里面已经有了
# from utils.io import *
from languages.lang import * from languages.lang import *
MainConsole.print( MainConsole.print(
@ -36,30 +36,29 @@ MainConsole.print(
justify="center", justify="center",
) )
osc.project_name = "伶伦" osc.project_name = "伶伦"
osc.version = __version__ osc.version = __version__
def go_for_args( def go_for_args(
languageChange: str = "ZH-CN", debugMode: str = 'False', logfile: str = 'True' languageChange: str = "ZH-CN", debugMode: str = "False", logfile: str = "True"
): ):
global currentLang global currentLang
global logger global logger
currentLang = ( currentLang = (
languageChange.upper() languageChange.upper()
if languageChange.upper() in languages.keys() if languageChange.upper() in languages.keys()
else 'ZH-CN' else "ZH-CN"
) )
osc.isRelease = False if debugMode.lower() in ("true", '1') else True osc.isRelease = False if debugMode.lower() in ("true", "1") else True
logger.printing=not osc.isRelease logger.printing = not osc.isRelease
logger.writing=True if logfile.lower() in ("true", '1') else False logger.writing = True if logfile.lower() in ("true", "1") else False
if len(sys.argv) > 0: if len(sys.argv) > 0:
go_for_args(*sys.argv) go_for_args(*sys.argv)
def _(__): def _(__):
""" """
`languages` `languages`
@ -76,7 +75,7 @@ nowYang = datetime.datetime.now()
if nowYang.month == 8 and nowYang.day == 6: if nowYang.month == 8 and nowYang.day == 6:
# 诸葛八卦生日 # 诸葛八卦生日
MainConsole.print( MainConsole.print(
"[#7DB5F0 on #121110]今天可不是催更的日子!\n诸葛亮与八卦阵{}岁生日快乐!".format(nowYang.year - 2009), "[#7DB5F0 on #121110]今天可不是催更的日子!\n诸葛亮与八卦阵{}岁生日快乐!".format(nowYang.year - 2008),
style="#7DB5F0 on #121110", style="#7DB5F0 on #121110",
justify="center", justify="center",
) )
@ -91,15 +90,11 @@ else:
# 显示箴言部分 # 显示箴言部分
try: try:
MainConsole.print( MainConsole.print(
"[#121110 on #F0F2F4]{}".format( "[#121110 on #F0F2F4]{}".format(random.choice(myWords)),
random.choice(
myWords
)
),
style="#121110 on #F0F2F4", style="#121110 on #F0F2F4",
justify="center", justify="center",
) )
except (ConnectionError,SSLError): except (ConnectionError, SSLError):
MainConsole.print( MainConsole.print(
"[#121110 on #F0F2F4]以梦想为驱使 创造属于自己的未来", "[#121110 on #F0F2F4]以梦想为驱使 创造属于自己的未来",
style="#121110 on #F0F2F4", style="#121110 on #F0F2F4",

View File

@ -2,3 +2,4 @@ Brotli>=1.0.9
mido>=1.2.10 mido>=1.2.10
Musicreater>=0.1.0 Musicreater>=0.1.0
TrimLog>=0.1.0 TrimLog>=0.1.0
requests>=2.25.1

View File

@ -1,5 +1,3 @@
from typing import Any, Literal, Optional, TextIO from typing import Any, Literal, Optional, TextIO
import requests import requests
@ -12,11 +10,22 @@ osc = object_constants.ObjectStateConstant()
logger = TrimLog.Logger( logger = TrimLog.Logger(
is_logging=True, is_logging=True,
printing=not osc.isRelease, printing=not osc.isRelease,
in_suffix='.llc', in_suffix=".llc",
) )
myWords = requests.get(
try:
myWords = (
requests.get(
"https://gitee.com/TriM-Organization/LinglunStudio/raw/master/resources/myWords.txt" "https://gitee.com/TriM-Organization/LinglunStudio/raw/master/resources/myWords.txt"
).text.strip("\n").split("\n") )
.text.strip("\n")
.split("\n")
)
except (ConnectionError, SSLError):
myWords = "以梦想为驱使 创造属于自己的未来"
# noinspection PyBroadException
except BaseException:
myWords = "以梦想为驱使 创造属于自己的未来"
JustifyMethod = Literal["default", "left", "center", "right", "full"] JustifyMethod = Literal["default", "left", "center", "right", "full"]
@ -157,7 +166,8 @@ def format_ipt(
try: try:
fun_result = fun(result, *extraArg) fun_result = fun(result, *extraArg)
break break
except: # noinspection PyBroadException
except BaseException:
prt(err_note) prt(err_note)
continue continue
return result, fun_result return result, fun_result