mirror of
https://github.com/TriM-Organization/Linglun-Converter.git
synced 2024-11-25 00:25:26 +08:00
减少依赖
This commit is contained in:
parent
3a63b25dfd
commit
431a40650a
@ -5,7 +5,6 @@
|
|||||||
Copyright © 2023 all the developers of LinglunStudio
|
Copyright © 2023 all the developers of LinglunStudio
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from utils.io import logger, requests
|
|
||||||
|
|
||||||
DEFAULTLANGUAGE = "ZH-CN"
|
DEFAULTLANGUAGE = "ZH-CN"
|
||||||
|
|
||||||
@ -86,8 +85,11 @@ languages = {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# 这个函数是不被加载的
|
||||||
def passbt():
|
def passbt():
|
||||||
|
|
||||||
|
from utils.io import logger, requests
|
||||||
|
|
||||||
def __loadLanguage(languageFilename: str):
|
def __loadLanguage(languageFilename: str):
|
||||||
with open(languageFilename, "r", encoding="utf-8") as languageFile:
|
with open(languageFilename, "r", encoding="utf-8") as languageFile:
|
||||||
_text = {}
|
_text = {}
|
||||||
|
@ -26,9 +26,8 @@ print("https://dislink.github.io/midi2bdx/")
|
|||||||
|
|
||||||
import Musicreater
|
import Musicreater
|
||||||
|
|
||||||
# 这一句可以不要,因为lang里面已经有了
|
|
||||||
from utils.io import *
|
from utils.io import *
|
||||||
from languages.lang import *
|
from languages.lang import languages
|
||||||
|
|
||||||
MainConsole.print(
|
MainConsole.print(
|
||||||
"[#121110 on #F0F2F4] ",
|
"[#121110 on #F0F2F4] ",
|
||||||
@ -36,7 +35,7 @@ MainConsole.print(
|
|||||||
justify="center",
|
justify="center",
|
||||||
)
|
)
|
||||||
|
|
||||||
osc.project_name = "伶伦"
|
osc.project_name = "伶伦转换器"
|
||||||
osc.version = __version__
|
osc.version = __version__
|
||||||
|
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
Brotli>=1.0.9
|
Brotli>=1.0.9
|
||||||
mido>=1.2.10
|
mido>=1.2.10
|
||||||
|
rich>=10.9.0
|
||||||
Musicreater>=0.1.0
|
Musicreater>=0.1.0
|
||||||
TrimLog>=0.1.0
|
TrimLog>=0.1.0
|
||||||
requests>=2.25.1
|
|
||||||
|
19
utils/io.py
19
utils/io.py
@ -1,7 +1,7 @@
|
|||||||
from typing import Any, Literal, Optional, TextIO
|
from typing import Any, Literal, Optional, TextIO
|
||||||
|
|
||||||
import requests
|
import urllib.request
|
||||||
from requests.exceptions import *
|
import urllib.error
|
||||||
import TrimLog
|
import TrimLog
|
||||||
from TrimLog import Console, object_constants
|
from TrimLog import Console, object_constants
|
||||||
|
|
||||||
@ -13,18 +13,23 @@ logger = TrimLog.Logger(
|
|||||||
in_suffix=".llc",
|
in_suffix=".llc",
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
myWords = (
|
myWords = (
|
||||||
requests.get(
|
urllib.request.urlopen(
|
||||||
"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")
|
.read()
|
||||||
|
.decode('utf-8')
|
||||||
|
.strip("\n")
|
||||||
.split("\n")
|
.split("\n")
|
||||||
)
|
)
|
||||||
except (ConnectionError, SSLError):
|
except (ConnectionError, urllib.error.HTTPError) as E:
|
||||||
|
logger.warning(f"读取言·论信息发生 互联网连接 错误:\n{E}")
|
||||||
myWords = ["以梦想为驱使 创造属于自己的未来"]
|
myWords = ["以梦想为驱使 创造属于自己的未来"]
|
||||||
# noinspection PyBroadException
|
# noinspection PyBroadException
|
||||||
except BaseException:
|
except BaseException as E:
|
||||||
|
logger.warning(f"读取言·论信息发生 未知 错误:\n{E}")
|
||||||
myWords = ["以梦想为驱使 创造属于自己的未来"]
|
myWords = ["以梦想为驱使 创造属于自己的未来"]
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user