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