5 Commits

Author SHA1 Message Date
EillesWan
2ff857fce7 1. 支持更高版本的音·创
2. 修复部分参数未调用的问题
2025-06-19 04:24:29 +08:00
EillesWan
b2fd1c331b 2025-05-10 00:52:56 +08:00
EillesWan
c4b1202523 修复配置文件读写问题。 2025-05-10 00:38:47 +08:00
金羿ELS
782b88e3c4 add LICENSE.md.
Signed-off-by: 金羿ELS <eilleswan@outlook.com>
2025-05-08 18:18:50 +00:00
金羿ELS
bcdb9fc51c 删除文件 LICENSE.md 2025-05-08 18:17:17 +00:00
10 changed files with 81 additions and 28 deletions

View File

@@ -1,13 +1,16 @@
# 从镜像站点拷贝基础系统
FROM docker.1ms.run/library/python:3.10-slim-bullseye
ENV TZ Asia/Taipei
# 工作目录
WORKDIR /app
# RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 省的说我给人删了不备份
RUN touch /etc/apt/sources.list
RUN cp /etc/apt/sources.list /etc/apt/sources.list.bak
# 换源!!
RUN echo "deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" > /etc/apt/sources.list && \
echo "deb-src https://mirrors.aliyun.com/debian/ bullseye main non-free contrib" >> /etc/apt/sources.list && \
echo "deb https://mirrors.aliyun.com/debian-security/ bullseye-security main" >> /etc/apt/sources.list && \
@@ -18,21 +21,22 @@ RUN echo "deb https://mirrors.aliyun.com/debian/ bullseye main non-free contrib"
echo "deb-src https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" >> /etc/apt/sources.list
# 下个 Git
RUN apt-get update && apt-get install -y git && \
# 清理 apt 缓存
rm -rf /var/lib/apt/lists/*
# 克隆指定的 git 仓库
# 克隆伶伦仓库
RUN git clone https://gitee.com/TriM-Organization/Linglun-Converter.git
# 创建 Python 虚拟环境
RUN python3 -m venv /app/venv
# 处理依赖
RUN . /app/venv/bin/activate && \
pip config set global.index-url https://mirrors.aliyun.com/pypi/simple/ && \
/app/venv/bin/python3 -m pip install --upgrade pip && \
pip install --no-cache-dir --upgrade "Musicreater[full]" TrimLog requests zhDateTime
pip install --no-cache-dir --upgrade "Musicreater[full]" TrimLog requests zhDateTime "setuptools<80"
# 切换到克隆下来的仓库目录
WORKDIR /app/Linglun-Converter

34
clean_pycache.py Normal file
View File

@@ -0,0 +1,34 @@
import os
import shutil
from rich.console import Console
from rich.progress import track
console = Console()
def main():
with console.status("正在搜寻可清理之文件"):
egg_info: list = []
for file in os.listdir():
if file.endswith((".egg-info", ".spec")):
egg_info.append(file)
console.print(file)
pycache: list = []
for dirpath, dirnames, filenames in os.walk("./"):
for dirname in dirnames:
if dirname == "__pycache__":
pycache.append(fn := os.path.join(dirpath, dirname))
console.print(fn)
for file in track(
["build", "dist", "logs", "log", *egg_info, *pycache], description="正在清理"
):
if os.path.isdir(file) and os.access(file, os.W_OK):
shutil.rmtree(file)
elif os.path.isfile(file) and os.access(file, os.W_OK):
os.remove(file)
if __name__ == "__main__":
main()

View File

@@ -19,7 +19,7 @@ The Licensor of _Linglun Converter CLI_("this project") is Eilles Wan.
详细的准许和限制条款请见原协议文本。
"""
__version__ = "0.0.9"
__version__ = "0.0.9.1"
import os
@@ -45,7 +45,6 @@ from utils.yanlun import solar_date, yanlun_texts
# import sys
# from Musicreater.plugin.mcstructure import commands_to_structure, commands_to_redstone_delay_structure
@@ -379,7 +378,7 @@ for singleMidi in midis:
else to_BDX_file_in_delay(cvt_mid, out_path, style, *prompts[3:])
)
if output_file_format == 1
else (cvt_method(cvt_mid, out_path, *prompts[2:]))
else (cvt_method(cvt_mid, out_path, *prompts[2:])) # type: ignore
)
)

View File

@@ -60,12 +60,12 @@ from utils.io import TrimLog, log__init__, logger, object_constants
from utils.packdata import enpack_llc_pack, load_msct_packed_data, unpack_llc_pack
from utils.update_check import check_update_release
from utils.webview import go_update_tip
from utils.yanlun import yanlun_bg_colour, yanlun_fg_colour, yanlun_texts
from utils.yanlun import STANDARD_WHITE, STANDART_BLACK, yanlun_texts
WHITE = (242, 244, 246) # F2F4F6
WHITE = wx.Colour(242, 244, 246) # F2F4F6
# WHITE2 = (248, 252, 255)
# WHITE3 = (233, 236, 240)
BLACK = (18, 17, 16) # 121110
BLACK = wx.Colour(18, 17, 16) # 121110
# BLACK2 = (9, 12, 14)
# BLACK3 = (0, 2, 6)
@@ -74,10 +74,12 @@ BLACK = (18, 17, 16) # 121110
# BLACK = (242, 244, 246) # 121110
# BLACK2 = (248, 252, 255)
yanlun_fg_colour = wx.Colour(*STANDARD_WHITE)
yanlun_bg_colour = wx.Colour(*STANDART_BLACK)
__appname__ = "伶伦转换器"
__version__ = "WXGUI 1.2.1"
__zhver__ = "WX图形界面 初代次版"
__version__ = "WXGUI 1.2.2"
__zhver__ = "WX图形界面 初代次版"
logger.info("检查更新")
@@ -343,6 +345,10 @@ logger.printing = not osc.is_release
yanlun_length = len(yanlun_texts)
logger.info("音·创内核版本:{}".format(Musicreater.__version__), mandatory_use=True)
logger.info("加载窗口布局……")
@@ -1354,13 +1360,13 @@ class ConvertPagePanel(wx.Panel):
)
def onSpeedSpinChanged(self, event):
if self.m_speed_spinCtrlDouble.Value > 1:
if self.m_speed_spinCtrlDouble.GetValue() > 1:
self.m_speed_slider.SetValue(
int((self.m_speed_spinCtrlDouble.Value + 8) * 50 / 9)
int((self.m_speed_spinCtrlDouble.GetValue() + 8) * 50 / 9)
)
else:
self.m_speed_slider.SetValue(
int((self.m_speed_spinCtrlDouble.Value - 0.01) * 5000 / 99)
int((self.m_speed_spinCtrlDouble.GetValue() - 0.01) * 5000 / 99)
)
def onProgressbarChecked(self, event):
@@ -1430,6 +1436,7 @@ class ConvertPagePanel(wx.Panel):
mid_cvt = ConvertClass[0].from_midi_file(
midi_file_path=file_name,
mismatch_error_ignorance=ignore_midi_mismatch_error,
play_speed=self.m_speed_spinCtrlDouble.GetValue(),
pitched_note_table=convert_tables["PITCHED"][
convert_table_selection["PITCHED"]
],
@@ -1437,6 +1444,8 @@ class ConvertPagePanel(wx.Panel):
convert_table_selection["PERCUSSION"]
],
old_exe_format=self.m_oldExeFormatChecker_checkBox3.GetValue(),
min_volume=self.m_volumn_spinCtrlDouble1.GetValue() / 100,
music_pitch_deviation=0,
)
cvt_dist = (
@@ -1525,7 +1534,7 @@ class ConvertPagePanel(wx.Panel):
size,
total_delay,
(
"\n指令数量:{}".format(cmd_num)
"\n指令数量:{}".format(cmd_num) # type: ignore
if self.m_playerChoice_choice2.GetSelection() == 0
else ""
),
@@ -2169,7 +2178,12 @@ if __name__ == "__main__":
app = LinglunConverterApp()
app.MainLoop()
try:
app.MainLoop()
except Exception as e:
logger.error(f"程序异常退出:{e}")
logger.info("关闭窗口,收尾任务")
if on_exit_saving:
enpack_llc_pack(

View File

@@ -1 +1,3 @@
pyinstaller -D ./llc_win_wxPython.py -i ./resources/LLC_LOGO_OK_PLAIN_BANNER.ico --hide-console minimize-late --clean -n 伶伦转换器
pyinstaller -D ./llc_win_wxPython.py -i ./resources/LLC_LOGO_OK_PLAIN_BANNER.ico --hide-console minimize-late --clean -n 伶伦转换器
pause
python ./clean_pycache.py

View File

@@ -130,7 +130,7 @@ class LingLunAuthorPageFrame(wx.Frame):
self.m_bitmap1 = wx.StaticBitmap(
self.eilles_pannel,
wx.ID_ANY,
wx.Bitmap(eilles_pic, wx.BITMAP_TYPE_ANY),
wx.BitmapBundle(wx.Image(eilles_pic, wx.BITMAP_TYPE_ANY)),
wx.DefaultPosition,
wx.DefaultSize,
0,
@@ -183,7 +183,7 @@ class LingLunAuthorPageFrame(wx.Frame):
bSizer41 = wx.BoxSizer(wx.VERTICAL)
bSizer41.Add((0, 0), 1, wx.EXPAND, 5)
bSizer41.Add(wx.Size(0, 0), 1, wx.EXPAND, 5)
self.m_staticText211 = wx.StaticText(
self.bgarray_pannel,

View File

@@ -30,7 +30,7 @@ def unpack_llc_pack(from_dist: str, raise_error: bool = True):
== hashlib.pbkdf2_hmac(
"sha256",
md5_value + packed_bytes,
salt(hashlib.sha256(brotli.__version__)),
salt(hashlib.sha256(str(brotli.__version__).encode("gb18030"))),
16,
)
):

View File

@@ -158,7 +158,7 @@ def check_update_release(
version_renew_tip.format(
app=appname, latest=version_content, current=version_now
),
code_content["release"]["release"]["description"],
code_content["release"]["release"]["description"].replace("\r\n", "\n"),
):
return dict(
[

View File

@@ -25,7 +25,7 @@ class HTMLFrame(wx.Frame):
tip_text,
web_text,
window_title: str = "新版本已发布",
bg_colour: tuple = (0, 0, 0),
bg_colour: tuple | wx.Colour = (0, 0, 0),
window_size: tuple = (800, 480),
):
"""构造函数"""
@@ -36,12 +36,12 @@ class HTMLFrame(wx.Frame):
id=wx.ID_ANY,
title=window_title,
pos=wx.DefaultPosition,
size=window_size,
size=wx.Size(*window_size),
style=wx.DEFAULT_FRAME_STYLE | wx.TAB_TRAVERSAL,
)
# self.SetIcon(wx.Icon('', wx.BITMAP_TYPE_ICO))
self.SetBackgroundColour(bg_colour)
self.SetBackgroundColour(wx.Colour(bg_colour))
self.Center()
self.SetSizeHints(wx.DefaultSize, wx.DefaultSize)

View File

@@ -19,8 +19,6 @@ from .io import logger, prt
STANDARD_WHITE = (242, 244, 246)
STANDART_BLACK = (18, 17, 16)
yanlun_fg_colour = STANDARD_WHITE
yanlun_bg_colour = STANDART_BLACK
logger.info("获取 言·论 信息……")
@@ -55,3 +53,5 @@ else:
except BaseException as E:
logger.warning(f"读取言·论信息发生 未知 错误:\n{E}")
yanlun_texts = ["灵光焕发 深艺献心"]
logger.info("已获取言·论 {}".format(len(yanlun_texts)))