mirror of
https://github.com/TriM-Organization/Linglun-Converter.git
synced 2026-01-07 04:11:56 +00:00
Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
680e8f5d3b | ||
|
|
8584f8df33 | ||
|
|
f8e073a2a9 | ||
|
|
2ff857fce7 | ||
|
|
b2fd1c331b | ||
|
|
c4b1202523 | ||
|
|
782b88e3c4 | ||
|
|
bcdb9fc51c | ||
|
|
e3b94f7445 | ||
|
|
59f5615a80 | ||
|
|
0d7a91904d |
45
Dockerfile
Normal file
45
Dockerfile
Normal file
@@ -0,0 +1,45 @@
|
||||
# 从镜像站点拷贝基础系统
|
||||
FROM docker.1ms.run/library/python:3.10-slim-bullseye
|
||||
|
||||
ENV TZ Asia/Taipei
|
||||
|
||||
# 工作目录
|
||||
WORKDIR /app
|
||||
|
||||
# 省的说我给人删了不备份
|
||||
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 && \
|
||||
echo "deb-src https://mirrors.aliyun.com/debian-security/ bullseye-security main" >> /etc/apt/sources.list && \
|
||||
echo "deb https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" >> /etc/apt/sources.list && \
|
||||
echo "deb-src https://mirrors.aliyun.com/debian/ bullseye-updates main non-free contrib" >> /etc/apt/sources.list && \
|
||||
echo "deb https://mirrors.aliyun.com/debian/ bullseye-backports main non-free contrib" >> /etc/apt/sources.list && \
|
||||
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/*
|
||||
|
||||
# 克隆伶伦仓库
|
||||
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 /app/Linglun-Converter/requirements_cli.txt
|
||||
|
||||
# 切换到克隆下来的仓库目录
|
||||
WORKDIR /app/Linglun-Converter
|
||||
|
||||
# 设置容器启动时执行的默认命令,使用虚拟环境中的 python
|
||||
CMD ["/app/venv/bin/python3", "llc_cli.py"]
|
||||
22
LICENSE.md
22
LICENSE.md
@@ -1,8 +1,8 @@
|
||||
<h1 align="center"><b><i>在 Gitee Push #4791dcd(不含)之后本仓库使用</i>《汉钰律许可协议 第一版》<i>开源</i></b></h1>
|
||||
<h1 align="center"><b><i>在 Gitee Push #4791dcd(不含)之后本仓库使用</i>《汉钰律许可协议,第一版》<i>授权开源</i></b></h1>
|
||||
|
||||
# 汉钰律许可协议
|
||||
# 汉钰律许可协议,第一版
|
||||
|
||||
**总第一版 · 二〇二四年七月七日编**
|
||||
**总第一版 第二次修订 · 二〇二四年七月七日编 二〇二五年四月二十六日修订**
|
||||
|
||||
## 一、重要须知
|
||||
|
||||
@@ -14,13 +14,13 @@
|
||||
|
||||
4. 由于互联网服务、互联网内容的特殊性,若本协议以电子协议形式分发并签订,其依然有效。您一旦开始对本协议所授权之作品进行本协议所授权的行为,即视为您已经阅读、理解并同意并已经接受本协议的全部条款。
|
||||
|
||||
5. 本协议的订立、履行、解释及争议的解决均**适用中华人民共和国法律并排除其他一切冲突法的适用**。_本协议订立于许可证最初的颁发者的地址。若其为自然人,则订立于该自然人户籍所在地;若为法人或非法人组织,则订立于其注册地_。本协议的订立各方应友好协商解决于协议所规定之行为的履行相关的争议;如协商不成,任何一方均可向合同签订地有管辖权的人民法院提起诉讼。
|
||||
5. 本协议的订立、履行、解释及争议的解决均**适用中华人民共和国法律并排除其他一切冲突法的适用**。_本协议订立于许可证最初的颁发者的地址。若颁发者为自然人,则订立于该自然人户籍所在地;若为法人或非法人组织,则订立于其注册地_。本协议的订立各方应友好协商解决于协议所规定之行为的履行相关的争议;如协商不成,任何一方均可向合同签订地有管辖权的人民法院提起诉讼。
|
||||
|
||||
6. 本协议的原本仅为现代汉语,书写于简体中文。若存在其他语言的翻译或其他同等语言但非简体中文文本的版本,应当无法律效力。
|
||||
|
||||
## 二、术语定义
|
||||
|
||||
1. “**许可证**”、“**协议**”(后文称“本协议”)是指根据本文档中所列举的全部术语、定义、条款、限制等文本,是本合同的简称称谓。本合同全称是“汉钰律许可协议”。
|
||||
1. “**许可证**”、“**协议**”(后文称“本协议”)是指根据本文档中所列举的全部术语、定义、条款、限制等文本,是本合同的简称称谓。本合同全称是 **“汉钰律许可协议,第一版”**。
|
||||
|
||||
2. “**协议颁发者**”(后文称“颁发者”)是将条款或协议应用于其拥有著作财产权的作品的民事主体,或由其指定从而拥有颁发者身份的民事主体。
|
||||
|
||||
@@ -30,13 +30,13 @@
|
||||
|
||||
5. “**采用本协议的作品**”(后文称“此作品”)是指经颁发者授权而使用本协议进行授权的任何作品,该作品应在自然人可见处明确附加一个自然人可读的版权通知(可以参考文末附录中提供的示例);若在一个可分割的作品中,部分地采用本协议进行授权,则该部分应当视为一个独立的采用本协议的作品,该作品应当在自然人可见处明确附加一个自然人可读的范围限定和版权通知(同样可以参考文末附录中提供的示例)。
|
||||
|
||||
6. “**贡献**”是指对作品进行的,意在提交给此作品颁发者以让著作权人包含在其作品中的任何修订或补充,该修订或补充同样属于一种作品。依据此定义,“提交”一词表示经由此作品颁发者所指定的形式,将其所进行的修改发送给此作品颁发者。该形式应当包括在此作品颁发者指定的平台内发送易于编辑的修改信息、在此作品颁发者指定的电子邮箱中发送易于编辑的修改信息、在此作品颁发者指定的源码控制系统或发布跟踪系统上提交的易于编辑的修改信息,但由著作权人以明显标注或指定为“非贡献”的活动除外。颁发者自己对作品进行的修改同样视作对作品的贡献。
|
||||
6. “**贡献**”是指对作品进行的,意在提交给此作品颁发者以让著作权人包含在其作品中的任何修订或补充,该修订或补充同样属于一种作品。依据此定义,**“提交”**一词表示经由此作品颁发者所指定的形式,将其所进行的修改发送给此作品颁发者。该形式应当包括在此作品颁发者指定的平台内发送易于编辑的修改信息、在此作品颁发者指定的电子邮箱中发送易于编辑的修改信息、在此作品颁发者指定的源码控制系统或发布跟踪系统上提交的易于编辑的修改信息,但由著作权人以明显标注或指定为“非贡献”的活动除外。颁发者自己对作品进行的修改同样视作对作品的贡献。
|
||||
|
||||
7. “**贡献者**”是指此作品颁发者接受的贡献的提交者,或包含在作品的贡献清单中的民事主体。贡献者在提交贡献并经此作品颁发者通过且该贡献已经被应用于此作品中后,该贡献者应当视为此作品的著作权人之一,但不应视为此作品非其贡献的部分的著作权人。一个作品的颁发者同样属于其贡献者。**请注意**,针对贡献者提交的贡献,该贡献者应被视为该贡献的协议颁发者,但不应视作本作品的颁发者。
|
||||
|
||||
8. “**用户**”、“**使用者**”是指行使本协议所授权之行为的民事主体。据此,贡献者亦属于用户。
|
||||
|
||||
9. “**商业性使用**”、“**商用**”是指任何以谋取利益为目的的使用,包括但不限于以贩卖、出租的形式对作品进行使用;但若将该牟利活动明确指示为“捐赠”,且在牟利者进行本协议所授权的活动时不以捐赠数额为标准,则此种的获取利益的“捐赠”行为不属于商业性使用。
|
||||
9. “**商业性使用**”、“**商用**”是指任何以谋取利益为目的的使用,包括但不限于以贩卖、出租的形式对作品进行使用;但若将该获取利益之活动明确指示为“捐赠”,且在获利者在进行本协议所授权的活动时不以捐赠数额为标准而区别之,则此种的获取利益的“捐赠”行为不属于商业性使用。
|
||||
|
||||
## 三、权利授予
|
||||
|
||||
@@ -84,7 +84,7 @@
|
||||
|
||||
该通知的内容仅供信息提供,不应对许可证进行任何文字上的修改。用户可在其分发的作品中,在不构成修改本协议的前提下,在作品自身的声明通知或属性描述后或作为附录添加。
|
||||
|
||||
6. 依据本款第 3 条,若用户二次分发此作品时,选择向作品的接收者提供收费的担保服务,则必须明确告知该接收者本协议全部内容与此作品原出处,并确保其知悉上述内容;但若用户在二次分发此作品是,不选择提供任何服务,则该用户不允许向作品的接收者收取任何费用,除非该用户获得了此作品颁发者的特殊许可、或该用户即为此作品颁发者本人。
|
||||
6. 依据本款第3条,若用户二次分发此作品时,选择向作品的接收者提供收费的担保服务,则必须明确告知该接收者本协议全部内容与此作品原出处,并确保其知悉上述内容;但若用户在二次分发此作品时,不选择提供任何服务,则该用户不允许向作品的接收者收取任何费用,除非该用户获得了此作品颁发者的特殊许可、或该用户即为此作品颁发者本人。
|
||||
|
||||
## 五、提交贡献
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
|
||||
## 七、免责声明
|
||||
|
||||
1. 若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,**不予提供任何形式的担保、任何明示、任何暗示或类似承诺**,此类包括但不限于担保此作品毫无缺陷、担保此作品适于贩卖、担保此作品适于特定目的、担保使用此作品绝不侵权。用户将自行承担因此作品的质量或性能问题而产生的全部风险。若此作品在任何方面欠妥,将由用户(而非任何贡献者、而非任何颁发者)承担所有必要的服务、维修或除错的任何成本。本免责声明本许可的重要组成部分。当且仅当遵守本免责声明时,本协议的其他条款中对本作品的使用授权方可生效。
|
||||
1. 若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,**不予提供任何形式的担保、任何明示、任何暗示或类似承诺**,此类包括但不限于担保此作品毫无缺陷、担保此作品适于贩卖、担保此作品适于特定目的、担保使用此作品绝不侵权。用户将自行承担因此作品的质量或性能问题而产生的全部风险。若此作品在任何方面欠妥,将由用户(而非任何贡献者、而非任何颁发者)承担所有必要的服务、维修或除错的任何成本。本免责声明是本许可的重要组成部分。当且仅当遵守本免责声明时,本协议的其他条款中对本作品的使用授权方可生效。
|
||||
|
||||
2. 无论是因何种原因,如果不是在法律规定的特殊情况(如,确为贡献者的故意或重大过失)下或者经过了特殊准许,即使贡献者事先已知发生损害的可能,在使用本作品时,用户产生的任何直接、间接、特殊、偶然或必然造成的损失(包括但不限于商誉损失、工作延误、计算机系统故障等),**均不由任一贡献者承担**。
|
||||
|
||||
@@ -118,7 +118,7 @@
|
||||
版权所有 © 〔年份〕 〔著作权人〕
|
||||
〔或者:版权所有 (C) 〔年份〕 〔著作权人〕〕
|
||||
|
||||
〔该作品〕根据 第一版 汉钰律许可协议(“本协议”)授权。
|
||||
〔该作品〕根据 汉钰律许可协议,第一版(“本协议”)授权。
|
||||
任何人皆可从以下地址获得本协议副本:〔本协议副本所在地址〕。
|
||||
若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,不予提供任何形式的担保、任何明示、任何暗示或类似承诺。也就是说,用户将自行承担因此作品的质量或性能问题而产生的全部风险。
|
||||
详细的准许和限制条款请见原协议文本。
|
||||
@@ -330,7 +330,7 @@
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
|
||||
Copyright © 2024 Team-Ryoun 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray")
|
||||
Copyright © 2025 Team-Ryoun 金羿("Eilles Wan") & 诸葛亮与八卦阵("bgArray")
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
|
||||
@@ -45,6 +45,10 @@
|
||||
|
||||
## 致谢 🙏
|
||||
|
||||
- 感谢由 **𝘼𝙪𝙤 “可白”**\<QQ2425476216\> 带来的 Dockerfile 文件参考;
|
||||
在此特别授予其利用本软件进行商业使用之权利:
|
||||
特别声明:依据《汉钰律许可协议,第一版》,准许**可白**\<QQ2425476216\>在中国大陆范围内非专有地对本作品进行商业性使用,包括但不限于:出售本作品之副本、将本作品嵌入云平台后租赁等。
|
||||
|
||||
> 感谢广大群友为此软件提供的测试和建议
|
||||
|
||||
## 联系 📞
|
||||
@@ -56,8 +60,8 @@ QQ 群 [861684859](https://jq.qq.com/?_wv=1027&k=hpeRxrYr)
|
||||
[Bilibili: 金羿ELS]: https://img.shields.io/badge/Bilibili-%E9%87%91%E7%BE%BFELS-00A1E7?style=for-the-badge
|
||||
[Bilibili: 诸葛亮与八卦阵]: https://img.shields.io/badge/Bilibili-%E8%AF%B8%E8%91%9B%E4%BA%AE%E4%B8%8E%E5%85%AB%E5%8D%A6%E9%98%B5-00A1E7?style=for-the-badge
|
||||
[CodeStyle: black]: https://img.shields.io/badge/code%20style-black-121110.svg?style=for-the-badge
|
||||
[python]: https://img.shields.io/badge/python-3.6-AB70FF?style=for-the-badge
|
||||
[python]: https://img.shields.io/badge/python-3.8-AB70FF?style=for-the-badge
|
||||
|
||||
<!-- [release]: https://img.shields.io//TriM-Organization/Linglun-Converter?style=for-the-badge -->
|
||||
|
||||
[license]: https://img.shields.io/badge/Licence-Apache-228B22?style=for-the-badge
|
||||
[license]: https://img.shields.io/badge/Licence-%E6%B1%89%E9%92%B0%E5%BE%8B%E8%AE%B8%E5%8F%AF%E5%8D%8F%E8%AE%AE-228B22?style=for-the-badge
|
||||
|
||||
34
clean_pycache.py
Normal file
34
clean_pycache.py
Normal 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()
|
||||
@@ -4,6 +4,8 @@
|
||||
|
||||
这里我们选用 **Termux** 作为我们的终端工具来安装,这是一个强大的终端模拟器,旨在安卓环境下模拟Linux的软件包环境。
|
||||
|
||||
> **注意** 若你的设备中已经有终端工具(例如 Utermux 之类的),请跳过此步骤。
|
||||
|
||||
1. 下载
|
||||
|
||||
下载可以通过 [GitHub源](https://github.com/termux/termux-app/releases) 或者 [F-Droid源](https://f-droid.org/en/packages/com.termux/) ,个人建议选择 F-Droid 源,因为在国内可以访问得到,而 GitHub 源就看运气。
|
||||
@@ -26,6 +28,8 @@
|
||||
|
||||
首先,我估计你等不了多久,急得要死,所以我们要让下载速度稍微快一点,先来换个源。在 **Termux** 中,输入以下指令:
|
||||
|
||||
> **注意** 这条指令很长,执行时请左右滑动以复制全部内容。
|
||||
|
||||
```bash
|
||||
echo "deb https://mirror.mwt.me/termux/main stable main" > /data/data/com.termux/files/usr/etc/apt/sources.list
|
||||
```
|
||||
@@ -33,8 +37,10 @@
|
||||
*感谢 天如<QQ 3291691454>为我们带来的简单换源方法。*
|
||||
|
||||
- *非必要步骤*:手动编辑换源
|
||||
|
||||
> **注意** 这是非必要的步骤,执行了也没有好处,小白别闲着没事干。
|
||||
|
||||
如果你闲着没事,非要要手动编辑个文档来换源,那用啥?用普通的编辑器肯定可以,于是我们就让他更普通一点,用**nano**吧!
|
||||
如果你闲着没事,非要要手动编辑个文档来换源,那就可以遵循这一部分的内容,我们先打开 **nano** 吧。
|
||||
|
||||
在 **Termux** 中,输入以下指令:
|
||||
|
||||
@@ -59,13 +65,13 @@
|
||||
|
||||
然后键入 `Ctrl`+`S`,再键入 `Ctrl`+`X`,退出`nano`。
|
||||
|
||||
在换源之后,你可能会见到类似的提示:
|
||||
在换源之后,你可能会见到类似的提示(“可能会”的意思是也可能不会):
|
||||
|
||||
```bash
|
||||
Your '/data/data/com.termux/files/usr/etc/apt/sources.list' file changed. Please run 'apt-get update'.
|
||||
```
|
||||
|
||||
那就遵循它的指引,输入:
|
||||
那就遵循它的指引(但无论出没出现上面的那个提示,都请执行下面的指令),输入:
|
||||
|
||||
```bash
|
||||
apt-get update
|
||||
@@ -94,61 +100,54 @@
|
||||
|
||||
如果输出了形如 `Python 3.X.X` 的提示,则完成。
|
||||
|
||||
3. 安装依赖库
|
||||
3. 构建环境并安装依赖库
|
||||
|
||||
以下长段中井号“#”开头的是注释,无需复制输入。
|
||||
|
||||
```bash
|
||||
# 首先换源
|
||||
pip config set global.index-url http://mirrors.aliyun.com/pypi/simple/
|
||||
# 然后安装(依次执行下面的指令)
|
||||
# 然后安装 numpy
|
||||
apt-get install python-numpy
|
||||
pip install brotli TrimMCStruct
|
||||
pip install Musicreater TrimLog
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
# 新建虚拟环境
|
||||
python -m venv ./.venv
|
||||
```
|
||||
|
||||
- 如果出现以下情况,真是死了鬼的,我们要来再搞个设置:
|
||||
|
||||
<img height="512" src="https://foruda.gitee.com/images/1665933289612919459/b87b7804_9911226.jpeg">
|
||||
|
||||
我们来修改收信任的源设置:
|
||||
|
||||
```bash
|
||||
pip config set global.trusted-host mirrors.aliyun.com/
|
||||
```
|
||||
|
||||
之后再来安装即可
|
||||
|
||||
```bash
|
||||
pip install brotli TrimMCStruct
|
||||
pip install Musicreater TrimLog
|
||||
python -m pip install --upgrade pip setuptools wheel
|
||||
```
|
||||
|
||||
<!--
|
||||
安装成功后您可能会见到类似下图的提示:
|
||||
|
||||
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
||||
-->
|
||||
|
||||
### 安装下载工具
|
||||
|
||||
既然已经有了运行环境,那么我们就需要下载一个用来下载我们的**伶伦转换器**的工具,我非常推崇**Git**这种方便快捷好用还能下载仓库的代码管理器,这个世界上你也找不到第二个,所以我们来安装一下:
|
||||
|
||||
```bash
|
||||
pkg install git
|
||||
apt install git
|
||||
```
|
||||
|
||||
安装完成后记得测试一下:
|
||||
安装完成后可以测试一下是否安装成功:
|
||||
|
||||
```bash
|
||||
git --version
|
||||
```
|
||||
|
||||
你可能会见到类似 `git version 2.x.x` 的提示,表示安装成功。
|
||||
|
||||
<!--
|
||||
<img height="512" src="https://foruda.gitee.com/images/1665933331269483373/9374c85d_9911226.jpeg">
|
||||
-->
|
||||
|
||||
## 本软件的下载与使用
|
||||
|
||||
1. 使用Git下载本程序代码
|
||||
0. 使用Git下载本程序代码
|
||||
|
||||
```bash
|
||||
```git
|
||||
git clone https://gitee.com/TriM-Organization/Linglun-Converter.git llc
|
||||
```
|
||||
|
||||
当上述命令执行成功,你会在执行此命令的所在位置发现一个名为 `llc` 的文件夹,其中包含的正是我们心心念念下载的本程序源代码。
|
||||
当上述命令执行成功,你会在执行此命令的所在位置发现一个名为 `llc` 的文件夹,其中包含的正是我们心心念念下载的本程序源代码。
|
||||
本程序可以直接从源代码运行,因此,赶快进入下载到的文件夹:
|
||||
|
||||
```bash
|
||||
@@ -157,13 +156,20 @@ pkg install git
|
||||
|
||||
1. 开始使用命令行程序
|
||||
|
||||
依照你的需要,执行以下命令以运行程序:
|
||||
执行以下命令以运行伶伦转换器:
|
||||
|
||||
```bash
|
||||
python llc_cli.py
|
||||
source ./run_cli.sh
|
||||
```
|
||||
|
||||
运行成功了,哦耶!
|
||||
|
||||
<img height="512" src="https://foruda.gitee.com/images/1686963721390700714/b82fb3d5_9911226.png">
|
||||
|
||||
2. 软件更新
|
||||
|
||||
有时可能需要更新本程序,请在进入到本程序所在的文件夹(上述`cd llc`即此)后,执行以下命令:
|
||||
|
||||
```bash
|
||||
git pull
|
||||
```
|
||||
|
||||
@@ -1,7 +1,20 @@
|
||||
|
||||
## 运行环境安装
|
||||
|
||||
### 检验Python运行环境
|
||||
## 一、【控制台】使用 Docker
|
||||
|
||||
请使用根目录下的 `Dockerfile` 来构建镜像,并运行镜像。
|
||||
|
||||
## 二、【图形化用户界面】暂无内容
|
||||
|
||||
*未完待续*
|
||||
|
||||
------
|
||||
|
||||
## 三、【控制台】手动安装(*不建议*)
|
||||
|
||||
### 运行环境安装
|
||||
|
||||
#### 检验Python运行环境
|
||||
|
||||
0. 一般的Linux发行版都有安装Python环境,我们只需要保证其版本即可,理论上 ≥Python3.6 都可以运行我们的库
|
||||
|
||||
@@ -43,7 +56,7 @@
|
||||
|
||||
暂无
|
||||
|
||||
### 检查并安装pip包管理器依赖
|
||||
#### 检查并安装pip包管理器依赖
|
||||
|
||||
1. 我们在安装依赖库之前,应该确认一下,Python自带的包管理器pip是否安装到位:
|
||||
|
||||
@@ -65,22 +78,19 @@
|
||||
# 安装完成后一定要验证!!!
|
||||
python -m pip
|
||||
```
|
||||
|
||||
<!--
|
||||
2. 确认完成之后,我们来安装一下依赖库:
|
||||
|
||||
```bash
|
||||
pip install mido -i https://mirrors.aliyun.com/pypi/simple/
|
||||
pip install brotli -i https://mirrors.aliyun.com/pypi/simple/
|
||||
pip install Musicreater -i https://mirrors.aliyun.com/pypi/simple/
|
||||
pip install TrimLog -i https://mirrors.aliyun.com/pypi/simple/
|
||||
pip install -r requirements_cli.txt -i https://mirrors.aliyun.com/pypi/simple/
|
||||
```
|
||||
|
||||
3. 安装成功后可能会见到类似下图的提示:
|
||||
|
||||
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
||||
-->
|
||||
|
||||
|
||||
## 本代码库的下载与使用
|
||||
### 本代码库的下载与使用
|
||||
|
||||
1. 使用Git下载本库及其示例代码
|
||||
|
||||
@@ -95,11 +105,20 @@
|
||||
cd llc
|
||||
```
|
||||
|
||||
1. 开始使用
|
||||
1. 新建虚拟环境
|
||||
|
||||
在目录下打开终端,执行以下命令以运行演示程序:
|
||||
在目录下打开终端,或者继续沿用我们刚才已经`cd`过`llc`的终端,执行以下命令以新建虚拟环境:
|
||||
|
||||
```bash
|
||||
python llc_cli.py
|
||||
python -m venv ./.venv
|
||||
```
|
||||
|
||||
2. 运行示例程序
|
||||
|
||||
执行以下命令以运行演示程序:
|
||||
|
||||
```bash
|
||||
source ./run_cli.sh
|
||||
```
|
||||
|
||||
该脚本会自动激活虚拟环境,你也可以通过手动执行`source ./.venv/bin/activate`来激活之。
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
## 运行打包文件(推荐)
|
||||
## 运行可执行文件(推荐)
|
||||
|
||||
### 一、下载打包好的应用程序
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
<img src=https://foruda.gitee.com/images/1699106948861444130/30c156bc_9911226.png>
|
||||
|
||||
|
||||
## 从代码运行(最新功能)
|
||||
## 从代码运行(不建议)
|
||||
|
||||
### 一、运行环境安装
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
|
||||
1. 首先需要下载Python的安装包,最好是 *Python3.10*,因为作者就用的是这个版本
|
||||
|
||||
!注意!此程序现已不支持Python3.6。请更新到至少Python3.8,但是,我们对于Python3.8的支持也即将停止,为了更好的兼容,避免不必要的麻烦,我们强烈建议您更新到Python3.10。(这意味着我们即将放弃对Windows7的支持)
|
||||
!注意!此程序现已不支持 Python3.6。请更新到至少Python3.8,但是,我们对于 Python3.8 的支持也即将停止,为了更好的兼容,避免不必要的麻烦,我们强烈建议您更新到 Python3.10。(这意味着我们即将放弃对 Windows7 的支持)
|
||||
|
||||
> [下载64位Python3.10安装包](https://www.python.org/ftp/python/3.10.11/python-3.10.11-amd64.exe)
|
||||
> [下载32位Python3.10安装包](https://www.python.org/ftp/python/3.10.11/python-3.10.11.exe)
|
||||
@@ -38,13 +38,13 @@
|
||||
|
||||
<img src=https://foruda.gitee.com/images/1662736520757331846/e38efb81_9911226.png>
|
||||
|
||||
- 若您对Python一知半解或者不怎么了解、并对自己的系统盘(通常是C盘)有大约150*兆字节*(MB)的信心的话,您可以在安装时直接选择*快速安装*(Install Now)
|
||||
- 若您对 Python 一知半解或者不怎么了解、并对自己的系统盘(通常是C盘)有大约 150 *兆字节*(MB)的信心的话,您可以在安装时直接选择*快速安装*(Install Now)
|
||||
|
||||
3. 若您选择了*自定义安装*(Customize Installation),请务必勾选 `pip` 和 `py launcher` 便于后续安装依赖,如下图:
|
||||
|
||||
<img src=https://foruda.gitee.com/images/1662736621235871190/2ac3d98f_9911226.png>
|
||||
|
||||
4. 安装结束之后可以在*终端*(命令行/PowerShell/Bash/etc)中输入:`python -V` 试试是否安装成功,成功安装之后,在终端中输入python会显示诸如如下图片的提示:
|
||||
4. 安装结束之后可以在*终端*工具(例如 命令行/PowerShell/Bash 之类的都是终端工具)中输入:`python -V` 试试是否安装成功,成功安装之后,在终端中输入python会显示诸如如下图片的提示:
|
||||
|
||||
<img src=https://foruda.gitee.com/images/1699107336707287940/1837e2f6_9911226.png>
|
||||
|
||||
@@ -82,7 +82,7 @@
|
||||
|
||||
1. 开始使用
|
||||
|
||||
您可以直接双击 `llc_cli.py` 以运行演示程序,或者按照以下步骤使用终端应用运行。
|
||||
您可以直接双击 `llc_cli.py` 以运行软件,或者按照以下步骤使用终端应用运行。
|
||||
|
||||
在目录下打开终端。
|
||||
|
||||
|
||||
@@ -1,7 +1,21 @@
|
||||
|
||||
## Install Runtime Environment
|
||||
|
||||
### Install and Verify Python Runtime
|
||||
|
||||
## 1 CLI - Docker
|
||||
|
||||
Using the `Dockerfile` in the root directory to build a Docker image, and run it.
|
||||
|
||||
## 2 GUI
|
||||
|
||||
*to be written*
|
||||
|
||||
------
|
||||
|
||||
## 3 **Not Recommended** Manually Run the CLI code
|
||||
|
||||
### Install Runtime Environment
|
||||
|
||||
#### Install and Verify Python Runtime
|
||||
|
||||
0. Common Linux Distributions do include a Python Runtime Environment, what we should do is only to check whether it is a satisfied version to our program. If the version ≥Python3.6, theoretically our program can be run.
|
||||
|
||||
@@ -43,7 +57,7 @@
|
||||
|
||||
None yet.
|
||||
|
||||
### Install and Verify pip Package Manager
|
||||
#### Install and Verify pip Package Manager
|
||||
|
||||
1. Before installing, it is to be checked, wheather Python's pip is OK:
|
||||
|
||||
@@ -55,22 +69,21 @@
|
||||
/usr/bin/python: No module named pip
|
||||
# We can install pip via:
|
||||
sudo pacman -S python-pip
|
||||
# Verfy, remember.
|
||||
# Check, remember.
|
||||
python -m pip
|
||||
|
||||
|
||||
# If you did but failed, we should use other methods to install pip:
|
||||
wget https://bootstrap.pypa.io/get-pip.py
|
||||
sudo python get-pip.py
|
||||
# Verfy, must.
|
||||
# Double check, must.
|
||||
python -m pip
|
||||
```
|
||||
|
||||
2. After checking, let's install the dependences.
|
||||
|
||||
```bash
|
||||
pip install mido -i
|
||||
pip install brotli -i
|
||||
pip install -r requirements_cli.txt -i https://mirrors.aliyun.com/pypi/simple/
|
||||
```
|
||||
|
||||
3. See the tips below as successfully installed:
|
||||
@@ -78,25 +91,25 @@
|
||||
<img src="https://foruda.gitee.com/images/1662737676719454287/f61a70f7_9911226.png">
|
||||
|
||||
|
||||
## Download this lib's sources code and Using its demos.
|
||||
### Download this lib's sources code and Using its demos.
|
||||
|
||||
1. Download via Git
|
||||
|
||||
```bash
|
||||
git clone -b pkgver https://github.com/TriM-Organization/Musicreater.git MSCTpkgver
|
||||
git clone https://gitee.com/TriM-Organization/Linglun-Converter.git llc
|
||||
```
|
||||
|
||||
If succeed, a directory named `MSCTpkgver` well be found in the path you run this command, and inside it is the source code and demo(s) we wantted to download.
|
||||
What we want to use is the demo(s) so enter the folder via:
|
||||
If succeed, a directory named `llc` well be found in the path you run this command, and inside it is the source codes we wantted to download.
|
||||
What we want to use is in the folder so enter the folder via:
|
||||
|
||||
```bash
|
||||
cd MSCTpkgver
|
||||
cd llc
|
||||
```
|
||||
|
||||
1. Starting Using Demo(s)
|
||||
1. Starting Using
|
||||
|
||||
Via
|
||||
|
||||
```bash
|
||||
python magicDemo.py
|
||||
python llc_cli.py
|
||||
```
|
||||
|
||||
58
llc_cli.py
58
llc_cli.py
@@ -7,42 +7,55 @@
|
||||
伶伦转换器 命令行
|
||||
Linglun Converter CLI
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
伶伦转换器命令行版本(“本项目”)的协议颁发者为 金羿
|
||||
The Licensor of _Linglun Converter CLI_("this project") is Eilles Wan.
|
||||
|
||||
本项目根据 第一版 汉钰律许可协议(“本协议”)授权。
|
||||
本项目根据 汉钰律许可协议,第一版(“本协议”)授权。
|
||||
任何人皆可从以下地址获得本协议副本:https://gitee.com/EillesWan/YulvLicenses。
|
||||
若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,不予提供任何形式的担保、任何明示、任何暗示或类似承诺。也就是说,用户将自行承担因此作品的质量或性能问题而产生的全部风险。
|
||||
详细的准许和限制条款请见原协议文本。
|
||||
"""
|
||||
|
||||
__version__ = "0.0.8"
|
||||
__version__ = "0.0.9.2"
|
||||
|
||||
|
||||
import os
|
||||
import random
|
||||
|
||||
try:
|
||||
|
||||
import Musicreater
|
||||
from Musicreater import DEFAULT_PROGRESSBAR_STYLE
|
||||
from Musicreater.plugin.addonpack import (
|
||||
to_addon_pack_in_delay,
|
||||
to_addon_pack_in_repeater,
|
||||
to_addon_pack_in_score,
|
||||
)
|
||||
from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_score
|
||||
from Musicreater.plugin.mcstructfile import (
|
||||
to_mcstructure_file_in_delay,
|
||||
to_mcstructure_file_in_repeater,
|
||||
to_mcstructure_file_in_score,
|
||||
)
|
||||
|
||||
from utils.io import bool_str, float_str, int_str, ipt, isin, logger, prt
|
||||
from utils.yanlun import solar_date, yanlun_texts
|
||||
|
||||
except ImportError:
|
||||
if input("[ERROR] 当前环境中未安装所需依赖库,是否直接安装依赖库?[Y/n]") in (
|
||||
"y",
|
||||
"Y",
|
||||
):
|
||||
os.system("pip install -r ./requirements_cli.txt")
|
||||
print("[INFO] 安装完成,请重新启动。")
|
||||
|
||||
exit()
|
||||
|
||||
# import sys
|
||||
|
||||
import Musicreater
|
||||
from Musicreater import DEFAULT_PROGRESSBAR_STYLE
|
||||
from Musicreater.plugin.addonpack import (
|
||||
to_addon_pack_in_delay,
|
||||
to_addon_pack_in_repeater,
|
||||
to_addon_pack_in_score,
|
||||
)
|
||||
|
||||
from Musicreater.plugin.mcstructfile import (
|
||||
to_mcstructure_file_in_delay,
|
||||
to_mcstructure_file_in_repeater,
|
||||
to_mcstructure_file_in_score,
|
||||
)
|
||||
from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_score
|
||||
from utils.io import logger, int_str, prt, ipt, isin, bool_str, float_str
|
||||
from utils.yanlun import yanlun_texts, solar_date
|
||||
|
||||
# from Musicreater.plugin.mcstructure import commands_to_structure, commands_to_redstone_delay_structure
|
||||
|
||||
@@ -204,7 +217,7 @@ def is_in_player(sth: str, in_ok: tuple = (0, 1, 2)):
|
||||
|
||||
|
||||
output_file_format = format_ipt(
|
||||
"输出文件类型 (mcpack/0|bdx/1|mcstructure/2)",
|
||||
"输出文件类型 (mcpack/0|bdx/1|mcstructure/2):",
|
||||
is_in_bdx_mcpack,
|
||||
"输入内容有误,请重新输入。",
|
||||
)[1]
|
||||
@@ -348,6 +361,7 @@ if output_file_format == 0:
|
||||
cvt_method = to_addon_pack_in_delay
|
||||
elif player_format == 2:
|
||||
cvt_method = to_addon_pack_in_repeater
|
||||
|
||||
elif output_file_format == 2:
|
||||
if player_format == 1:
|
||||
cvt_method = to_mcstructure_file_in_score
|
||||
@@ -376,7 +390,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
|
||||
)
|
||||
)
|
||||
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
伶伦转换器暨模组特用奇巧
|
||||
Linglun Converter for Special Use with addons
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
伶伦转换器暨模组特用奇巧版本(“本项目”)的协议颁发者为 金羿
|
||||
The Licensor of _Linglun Converter for Special Use with addons_("this project") is Eilles Wan.
|
||||
|
||||
本项目根据 第一版 汉钰律许可协议(“本协议”)授权。
|
||||
本项目根据 汉钰律许可协议,第一版(“本协议”)授权。
|
||||
任何人皆可从以下地址获得本协议副本:https://gitee.com/EillesWan/YulvLicenses。
|
||||
若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,不予提供任何形式的担保、任何明示、任何暗示或类似承诺。也就是说,用户将自行承担因此作品的质量或性能问题而产生的全部风险。
|
||||
详细的准许和限制条款请见原协议文本。
|
||||
|
||||
@@ -4,13 +4,13 @@
|
||||
伶伦转换器 WXGUI
|
||||
Linglun Converter WxPython GUI
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
伶伦转换器WXGUI版本(“本项目”)的协议颁发者为 金羿
|
||||
The Licensor of _Linglun Converter WxPython GUI_("this project") is Eilles Wan.
|
||||
|
||||
本项目根据 第一版 汉钰律许可协议(“本协议”)授权。
|
||||
本项目根据 汉钰律许可协议,第一版(“本协议”)授权。
|
||||
任何人皆可从以下地址获得本协议副本:https://gitee.com/EillesWan/YulvLicenses。
|
||||
若非因法律要求或经过了特殊准许,此作品在根据本协议“原样”提供的基础上,不予提供任何形式的担保、任何明示、任何暗示或类似承诺。也就是说,用户将自行承担因此作品的质量或性能问题而产生的全部风险。
|
||||
详细的准许和限制条款请见原协议文本。
|
||||
@@ -21,7 +21,6 @@ The Licensor of _Linglun Converter WxPython GUI_("this project") is Eilles Wan.
|
||||
import os
|
||||
import random
|
||||
import sys
|
||||
|
||||
import threading
|
||||
|
||||
# from types import ModuleType
|
||||
@@ -40,30 +39,33 @@ if sys.argv:
|
||||
import Musicreater
|
||||
import Musicreater.experiment as Musicreater_experiment
|
||||
import Musicreater.plugin
|
||||
import wx
|
||||
import wx.propgrid as pg
|
||||
import wx.xrc
|
||||
from Musicreater.plugin.addonpack import (
|
||||
to_addon_pack_in_delay,
|
||||
to_addon_pack_in_repeater,
|
||||
to_addon_pack_in_score,
|
||||
)
|
||||
from Musicreater.plugin.websocket import to_websocket_server
|
||||
from Musicreater.plugin.bdxfile import to_BDX_file_in_delay, to_BDX_file_in_score
|
||||
from Musicreater.plugin.mcstructfile import (
|
||||
to_mcstructure_file_in_delay,
|
||||
to_mcstructure_file_in_repeater,
|
||||
to_mcstructure_file_in_score,
|
||||
)
|
||||
from Musicreater.plugin.websocket import to_websocket_server
|
||||
|
||||
import wx
|
||||
import wx.xrc
|
||||
import wx.propgrid as pg
|
||||
|
||||
from utils.io import logger, object_constants, log__init__, TrimLog
|
||||
from utils.yanlun import yanlun_texts, yanlun_fg_colour, yanlun_bg_colour
|
||||
from utils.authorp import go_author_page
|
||||
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.packdata import enpack_llc_pack, unpack_llc_pack, load_msct_packed_data
|
||||
from utils.webview import go_update_tip
|
||||
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)
|
||||
|
||||
@@ -72,32 +74,36 @@ 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.0.1"
|
||||
__zhver__ = "WX图形界面 初代次版"
|
||||
__version__ = "WXGUI 1.2.2"
|
||||
__zhver__ = "WX图形界面 初代次版二编"
|
||||
|
||||
|
||||
logger.info("检查更新")
|
||||
if __name__ == "__main__":
|
||||
|
||||
down_paths = check_update_release(
|
||||
"伶伦转换器",
|
||||
"https://gitee.com/TriM-Organization/Linglun-Converter/releases/latest",
|
||||
__version__,
|
||||
go_update_tip,
|
||||
logger,
|
||||
"!有新版本!\n新版本 {app} {latest} 可用,当前仍是 {current}\n请前往下载地址更新\n",
|
||||
)
|
||||
logger.info("检查更新")
|
||||
|
||||
|
||||
if down_paths:
|
||||
wx.LaunchDefaultBrowser(
|
||||
"https://gitee.com{}".format(
|
||||
[v for i, v in down_paths.items() if sys.platform in i][0]
|
||||
)
|
||||
down_paths = check_update_release(
|
||||
"伶伦转换器",
|
||||
"https://gitee.com/TriM-Organization/Linglun-Converter/releases/latest",
|
||||
__version__,
|
||||
go_update_tip,
|
||||
logger,
|
||||
"!有新版本!\n新版本 {app} {latest} 可用,当前仍是 {current}\n请前往下载地址更新\n",
|
||||
)
|
||||
exit()
|
||||
# go_update_tip("点击下方链接下载更新:",'<a href="https://gitee.com{}">点击此处下载</a>'.format(list(down_paths.values())[0]))
|
||||
|
||||
|
||||
if down_paths:
|
||||
wx.LaunchDefaultBrowser(
|
||||
"https://gitee.com{}".format(
|
||||
[v for i, v in down_paths.items() if sys.platform in i][0]
|
||||
)
|
||||
)
|
||||
exit()
|
||||
# go_update_tip("点击下方链接下载更新:",'<a href="https://gitee.com{}">点击此处下载</a>'.format(list(down_paths.values())[0]))
|
||||
|
||||
"""
|
||||
msct_main = msct_plugin = msct_plugin_function = None
|
||||
@@ -276,6 +282,7 @@ if down_paths:
|
||||
) = msct_plugin_function
|
||||
"""
|
||||
|
||||
|
||||
logger.info("注册变量并读取内容……")
|
||||
|
||||
|
||||
@@ -286,10 +293,14 @@ convert_tables = {
|
||||
"PITCHED": {
|
||||
"“偷吃”对照表": Musicreater.MM_TOUCH_PITCHED_INSTRUMENT_TABLE,
|
||||
"“经典”对照表": Musicreater.MM_CLASSIC_PITCHED_INSTRUMENT_TABLE,
|
||||
"“断联”对照表": Musicreater.MM_DISLINK_PITCHED_INSTRUMENT_TABLE,
|
||||
"“NBS”对照表": Musicreater.MM_NBS_PITCHED_INSTRUMENT_TABLE,
|
||||
},
|
||||
"PERCUSSION": {
|
||||
"“偷吃”对照表": Musicreater.MM_TOUCH_PERCUSSION_INSTRUMENT_TABLE,
|
||||
"“经典”对照表": Musicreater.MM_CLASSIC_PERCUSSION_INSTRUMENT_TABLE,
|
||||
"“断联”对照表": Musicreater.MM_DISLINK_PERCUSSION_INSTRUMENT_TABLE,
|
||||
"“NBS”对照表": Musicreater.MM_NBS_PERCUSSION_INSTRUMENT_TABLE,
|
||||
},
|
||||
}
|
||||
convert_table_selection = {
|
||||
@@ -337,6 +348,10 @@ logger.printing = not osc.is_release
|
||||
|
||||
yanlun_length = len(yanlun_texts)
|
||||
|
||||
|
||||
logger.info("音·创内核版本:{}".format(Musicreater.__version__), mandatory_use=True)
|
||||
|
||||
|
||||
logger.info("加载窗口布局……")
|
||||
|
||||
|
||||
@@ -745,7 +760,7 @@ class ConvertPagePanel(wx.Panel):
|
||||
wx.StaticBox(self, wx.ID_ANY, "选择输出格式"), wx.VERTICAL
|
||||
)
|
||||
|
||||
m_outformatChoice_choice1Choices = ["附加包", "BDX结构"]
|
||||
m_outformatChoice_choice1Choices = ["附加包", "MCSTRUCTURE结构", "BDX结构"]
|
||||
self.m_outformatChoice_choice1 = wx.Choice(
|
||||
ss_outputFormatChooseSizer.GetStaticBox(),
|
||||
wx.ID_ANY,
|
||||
@@ -774,7 +789,7 @@ class ConvertPagePanel(wx.Panel):
|
||||
m_playerChoice_choice2Choices,
|
||||
0,
|
||||
)
|
||||
self.m_playerChoice_choice2.SetSelection(2)
|
||||
self.m_playerChoice_choice2.SetSelection(1)
|
||||
ss_playerChooseSizer.Add(self.m_playerChoice_choice2, 0, wx.ALL | wx.EXPAND, 5)
|
||||
|
||||
s_formatChooseSizer.Add(ss_playerChooseSizer, 1, wx.ALL | wx.EXPAND, 5)
|
||||
@@ -1271,17 +1286,30 @@ class ConvertPagePanel(wx.Panel):
|
||||
|
||||
def onOutputFormatChosen(self, event):
|
||||
# 0: 附加包
|
||||
# 1: BDX
|
||||
# 1: MCSTRUCTURE
|
||||
# 2: BDX
|
||||
# prt("选择中:",self.m_outformatChoice_choice1.GetSelection())
|
||||
if self.m_outformatChoice_choice1.GetSelection() == 0:
|
||||
self.m_EnteringBDXfileSignName_textCtrl12.Enable(False)
|
||||
|
||||
if self.m_playerChoice_choice2.GetSelection() == 0:
|
||||
self.m_StructureHeight_slider7.Enable(False)
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(False)
|
||||
else:
|
||||
self.m_StructureHeight_slider7.Enable(True)
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(True)
|
||||
elif self.m_outformatChoice_choice1.GetSelection() == 1:
|
||||
|
||||
if self.m_outformatChoice_choice1.GetSelection() == 1:
|
||||
self.m_EnteringBDXfileSignName_textCtrl12.Enable(False)
|
||||
|
||||
if self.m_playerChoice_choice2.GetSelection() == 2:
|
||||
self.m_StructureHeight_slider7.Enable(False)
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(False)
|
||||
else:
|
||||
self.m_StructureHeight_slider7.Enable(True)
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(True)
|
||||
|
||||
elif self.m_outformatChoice_choice1.GetSelection() == 2:
|
||||
self.m_EnteringBDXfileSignName_textCtrl12.Enable(True)
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(True)
|
||||
self.m_StructureHeight_slider7.Enable(True)
|
||||
@@ -1290,20 +1318,27 @@ class ConvertPagePanel(wx.Panel):
|
||||
# 0 计分板 1 延时 2中继器
|
||||
if self.m_playerChoice_choice2.GetSelection() == 0:
|
||||
self.m_PlayerSelectorEntering_comboBox1.Enable(False)
|
||||
self.m_StructureHeight_slider7.Enable(False)
|
||||
|
||||
if self.m_outformatChoice_choice1.GetSelection() == 0:
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(False)
|
||||
elif self.m_outformatChoice_choice1.GetSelection() == 1:
|
||||
self.m_StructureHeight_slider7.Enable(False)
|
||||
else:
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(True)
|
||||
self.m_StructureHeight_slider7.Enable(True)
|
||||
|
||||
self.m_ScoreboardNameEntering_textCtrl9.Enable(True)
|
||||
self.m_IsAutoResetScoreboard_checkBox2.Enable(True)
|
||||
else:
|
||||
self.m_PlayerSelectorEntering_comboBox1.Enable(True)
|
||||
self.m_StructureHeight_slider7.Enable(True)
|
||||
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(True)
|
||||
if (self.m_outformatChoice_choice1.GetSelection() == 1) and (
|
||||
self.m_playerChoice_choice2.GetSelection() == 2
|
||||
):
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(False)
|
||||
self.m_StructureHeight_slider7.Enable(False)
|
||||
else:
|
||||
self.m_StructureHeight_slider7.Enable(True)
|
||||
self.m_enteringStructureMaxHeight_spinCtrl1.Enable(True)
|
||||
|
||||
self.m_ScoreboardNameEntering_textCtrl9.Enable(False)
|
||||
self.m_IsAutoResetScoreboard_checkBox2.Enable(False)
|
||||
@@ -1328,13 +1363,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):
|
||||
@@ -1404,6 +1439,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"]
|
||||
],
|
||||
@@ -1411,6 +1447,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 = (
|
||||
@@ -1420,7 +1458,8 @@ class ConvertPagePanel(wx.Panel):
|
||||
)
|
||||
|
||||
# 0: 附加包
|
||||
# 1: BDX
|
||||
# 1: mcstructure
|
||||
# 2: BDX
|
||||
|
||||
# 0 计分板 1 延时 2中继器
|
||||
if self.m_outformatChoice_choice1.GetSelection() == 0:
|
||||
@@ -1463,6 +1502,50 @@ class ConvertPagePanel(wx.Panel):
|
||||
wx.YES_DEFAULT | wx.ICON_INFORMATION,
|
||||
).ShowModal()
|
||||
elif self.m_outformatChoice_choice1.GetSelection() == 1:
|
||||
if self.m_playerChoice_choice2.GetSelection() == 0:
|
||||
size, total_delay, cmd_num = to_mcstructure_file_in_score(
|
||||
midi_cvt=mid_cvt,
|
||||
dist_path=cvt_dist,
|
||||
scoreboard_name=self.m_ScoreboardNameEntering_textCtrl9.GetValue(),
|
||||
auto_reset=self.m_IsAutoResetScoreboard_checkBox2.GetValue(),
|
||||
max_height=self.m_enteringStructureMaxHeight_spinCtrl1.GetValue(),
|
||||
)
|
||||
elif self.m_playerChoice_choice2.GetSelection() == 1:
|
||||
size, total_delay = to_mcstructure_file_in_delay(
|
||||
midi_cvt=mid_cvt,
|
||||
dist_path=cvt_dist,
|
||||
player=self.m_PlayerSelectorEntering_comboBox1.GetValue(),
|
||||
max_height=self.m_enteringStructureMaxHeight_spinCtrl1.GetValue(),
|
||||
)
|
||||
elif self.m_playerChoice_choice2.GetSelection() == 2:
|
||||
size, total_delay = to_mcstructure_file_in_repeater(
|
||||
midi_cvt=mid_cvt,
|
||||
dist_path=cvt_dist,
|
||||
player=self.m_PlayerSelectorEntering_comboBox1.GetValue(),
|
||||
)
|
||||
else:
|
||||
wx.MessageDialog(
|
||||
None,
|
||||
"你输入的播放器有误!",
|
||||
"错误",
|
||||
wx.YES_DEFAULT | wx.ICON_ERROR,
|
||||
).ShowModal()
|
||||
return
|
||||
wx.MessageDialog(
|
||||
None,
|
||||
"完成!\n结构大小:{}\n延迟总长:{}{}".format(
|
||||
size,
|
||||
total_delay,
|
||||
(
|
||||
"\n指令数量:{}".format(cmd_num) # type: ignore
|
||||
if self.m_playerChoice_choice2.GetSelection() == 0
|
||||
else ""
|
||||
),
|
||||
),
|
||||
"转换成功",
|
||||
wx.YES_DEFAULT | wx.ICON_INFORMATION,
|
||||
).ShowModal()
|
||||
elif self.m_outformatChoice_choice1.GetSelection() == 2:
|
||||
if self.m_playerChoice_choice2.GetSelection() == 0:
|
||||
cmd_num, total_delay, size, final_pos = to_BDX_file_in_score(
|
||||
midi_cvt=mid_cvt,
|
||||
@@ -1782,9 +1865,7 @@ class SettingPagePannel(wx.Panel):
|
||||
wx.ID_ANY,
|
||||
wx.DefaultPosition,
|
||||
wx.DefaultSize,
|
||||
pg.PG_BOLD_MODIFIED
|
||||
| pg.PG_HIDE_MARGIN
|
||||
| pg.PG_SPLITTER_AUTO_CENTER,
|
||||
pg.PG_BOLD_MODIFIED | pg.PG_HIDE_MARGIN | pg.PG_SPLITTER_AUTO_CENTER,
|
||||
)
|
||||
|
||||
self.m_pitched_notes_table_propertyGrid1.SetFont(
|
||||
@@ -1867,9 +1948,7 @@ class SettingPagePannel(wx.Panel):
|
||||
wx.ID_ANY,
|
||||
wx.DefaultPosition,
|
||||
wx.DefaultSize,
|
||||
pg.PG_BOLD_MODIFIED
|
||||
| pg.PG_HIDE_MARGIN
|
||||
| pg.PG_SPLITTER_AUTO_CENTER,
|
||||
pg.PG_BOLD_MODIFIED | pg.PG_HIDE_MARGIN | pg.PG_SPLITTER_AUTO_CENTER,
|
||||
)
|
||||
|
||||
self.m_percussion_notes_table_propertyGrid11.SetFont(
|
||||
@@ -2038,7 +2117,7 @@ class SettingPagePannel(wx.Panel):
|
||||
)
|
||||
if "自定义对照表" not in self.m_pitched_instrument_table_choice.Items:
|
||||
self.m_pitched_instrument_table_choice.Append("自定义对照表")
|
||||
self.m_pitched_instrument_table_choice.SetSelection(2)
|
||||
self.m_pitched_instrument_table_choice.SetSelection(4)
|
||||
|
||||
def onPitchedInstTableChanging(self, event):
|
||||
event.Skip()
|
||||
@@ -2087,7 +2166,7 @@ class SettingPagePannel(wx.Panel):
|
||||
)
|
||||
if "自定义对照表" not in self.m_percussion_instrument_table_choice1.Items:
|
||||
self.m_percussion_instrument_table_choice1.Append("自定义对照表")
|
||||
self.m_percussion_instrument_table_choice1.SetSelection(2)
|
||||
self.m_percussion_instrument_table_choice1.SetSelection(4)
|
||||
|
||||
def onPercussionInstTableChanging(self, event):
|
||||
event.Skip()
|
||||
@@ -2102,7 +2181,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(
|
||||
|
||||
3
pyinstaller_build.bat
Normal file
3
pyinstaller_build.bat
Normal file
@@ -0,0 +1,3 @@
|
||||
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
|
||||
@@ -1,10 +1,7 @@
|
||||
Musicreater>=2.1.0.1
|
||||
Musicreater[full]>=2.1.0.1
|
||||
TrimLog>=0.8.3
|
||||
requests>=2.0.0
|
||||
TrimMCStruct>=1.0.0
|
||||
rich
|
||||
wxPython
|
||||
dill
|
||||
brotli
|
||||
fcwslib=3.0.1
|
||||
zhDateTime>=1.0.3
|
||||
# fcwslib=3.0.1
|
||||
zhDateTime>=2.0.0
|
||||
|
||||
5
requirements_cli.txt
Normal file
5
requirements_cli.txt
Normal file
@@ -0,0 +1,5 @@
|
||||
setuptools < 80
|
||||
Musicreater[full]>=2.1.0.1
|
||||
TrimLog>=0.8.3
|
||||
requests>=2.0.0
|
||||
zhDateTime>=2.0.0
|
||||
@@ -8,11 +8,11 @@
|
||||
|
||||
**金羿ELS**、**金羿**、**Eilles Wan**、**丌幂**、**诸葛亮与八卦阵**、**诸葛八卦**、**BgArray**、**鸣凤鸽子**、**鱼旧梦**、**ElapsingDreams**等一众具有显著特征的自然人网名、自然人姓名、自然人专有名称之类之辞皆为专有标记,未经其本人允许不得擅自使用。
|
||||
|
||||
**伶伦工作站**、**伶伦转换器**、**LingLun Studio**、**LingLun Converter**、**音·创**、**Musicreater**等一众项目、软件、需求库之名称皆为专用之商业标记,未经其所有者允许不得擅自使用。
|
||||
**伶伦工作站**、**伶伦转换器**、**LingLun Studio**、**LingLun Converter**、**音·创**、**Musicreater**等一众项目、软件、需求库之名称皆为本项目专用之商业标记,未经其所有者允许不得擅自使用。
|
||||
|
||||
睿乐组织的徽标[**【木制展框上的惊异媒体】(睿思乐发)**](https://gitee.com/TriM-Organization/Linglun-Converter/raw/master/resources/TriMO_Theme.mp4)之图案及相关动画是**丌幂**所作的、**睿乐组织**的共同标志,其著作权归属**丌幂**所有,并授权给**睿乐组织**使用。其相关声像信息、睿乐组织的主题音[**【悦搏音符之回响】(睿思乐发)**](https://gitee.com/TriM-Organization/Linglun-Converter/raw/master/resources/TriMO_Theme.mp4)是**诸葛亮与八卦阵**所制作的、**睿乐组织**的共同标记,其著作权归属**诸葛亮与八卦阵**所有,并授权给**睿乐组织**使用。上述之图形、动画、声音等相关媒体信息皆为**睿乐组织**所专用的商业标记,未经**睿乐组织**之允许不得使用。
|
||||
睿乐组织的徽标[**【木制展框上的惊异媒体】(睿思乐发)**](./TriMO_Theme.mp4)之图案及相关动画是**丌幂**所作的、**睿乐组织**的共同标志,其著作权归属**丌幂**所有,并授权给**睿乐组织**使用。其相关声像信息、睿乐组织的主题音[**【悦搏音符之回响】(睿思乐发)**](./TriMO_Theme.mp4)是**诸葛亮与八卦阵**所制作的、**睿乐组织**的共同标记,其著作权归属**诸葛亮与八卦阵**所有,并授权给**睿乐组织**使用。上述之图形、动画、声音等相关媒体信息皆为**睿乐组织**所专用的商业标记,未经**睿乐组织**之允许不得使用。
|
||||
|
||||
[**木制框架中的乐灵**](https://gitee.com/TriM-Organization/Linglun-Converter/raw/master/resources/LLC_LOGO_OK_PLAIN_BANNER.png)之图案及相关动画、声音均为**伶伦工作站**之专用标记,未经**睿乐组织**之允许不得使用。
|
||||
[**木制框架中的乐灵**](./LLC_LOGO_OK_PLAIN_BANNER.png)之图案及相关动画、声音均为**伶伦工作站**之专用标记,未经**睿乐组织**之允许不得使用。
|
||||
|
||||
[**瓷板上的方块音符**](https://gitee.com/TriM-Organization/Musicreater/raw/master/resources/msctIcon.png)之图案及相关动画、声音均为**音·创库**之专用标记,未经**睿乐组织**之允许不得使用。
|
||||
|
||||
@@ -26,4 +26,4 @@
|
||||
不允许脱离于本项目而独立存在
|
||||
不得随任何其他非本项目之内的软件连带发布
|
||||
不得用于商业用途
|
||||
若本项目之源码被用于商业用途,应当将其从中剔除
|
||||
若本项目之源码被用于商业用途,除必要出现的显示外,应当将上述资源从中剔除
|
||||
2
run_cli.sh
Normal file
2
run_cli.sh
Normal file
@@ -0,0 +1,2 @@
|
||||
source ./.venv/bin/activate
|
||||
python ./llc_cli.py
|
||||
@@ -4,8 +4,8 @@
|
||||
伶伦转换器 作者信息组件
|
||||
Linglun Converter Author Page Component
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
开源相关声明请见 仓库根目录下的 License.md
|
||||
Terms & Conditions: License.md in the root directory
|
||||
@@ -13,9 +13,8 @@ Terms & Conditions: License.md in the root directory
|
||||
|
||||
|
||||
import wx
|
||||
import wx.xrc
|
||||
import wx.media
|
||||
|
||||
import wx.xrc
|
||||
|
||||
###########################################################################
|
||||
## Class LingLunAuthorPageFrame
|
||||
@@ -131,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,
|
||||
@@ -184,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,
|
||||
|
||||
11
utils/io.py
11
utils/io.py
@@ -4,8 +4,8 @@
|
||||
伶伦转换器 命令行组件
|
||||
Linglun Converter Command Line IO Component
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
开源相关声明请见 仓库根目录下的 License.md
|
||||
Terms & Conditions: License.md in the root directory
|
||||
@@ -16,20 +16,19 @@ from typing import (
|
||||
Any,
|
||||
Callable,
|
||||
Dict,
|
||||
Iterable,
|
||||
List,
|
||||
Literal,
|
||||
Optional,
|
||||
Sequence,
|
||||
Set,
|
||||
TextIO,
|
||||
Tuple,
|
||||
Iterable,
|
||||
Sequence,
|
||||
Union,
|
||||
)
|
||||
|
||||
import TrimLog
|
||||
from TrimLog import object_constants, logger, log__init__
|
||||
|
||||
from TrimLog import log__init__, logger, object_constants
|
||||
|
||||
logger.is_logging = True
|
||||
logger.suffix = ".llc"
|
||||
|
||||
@@ -4,15 +4,15 @@
|
||||
伶伦转换器 本地化组件
|
||||
Linglun Converter Language Localization Component
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
开源相关声明请见 仓库根目录下的 License.md
|
||||
Terms & Conditions: License.md in the root directory
|
||||
"""
|
||||
|
||||
|
||||
from .io import logger, Any
|
||||
from .io import Any, logger
|
||||
|
||||
|
||||
def _() -> str:
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
伶伦转换器 打包存档组件
|
||||
Linglun Converter Data Package Component
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
开源相关声明请见 仓库根目录下的 License.md
|
||||
Terms & Conditions: License.md in the root directory
|
||||
@@ -14,11 +14,11 @@ Terms & Conditions: License.md in the root directory
|
||||
|
||||
import hashlib
|
||||
|
||||
import dill
|
||||
import brotli
|
||||
import dill
|
||||
|
||||
from .salt import salt
|
||||
from .io import Any
|
||||
from .salt import salt
|
||||
|
||||
|
||||
def unpack_llc_pack(from_dist: str, raise_error: bool = True):
|
||||
@@ -27,7 +27,12 @@ def unpack_llc_pack(from_dist: str, raise_error: bool = True):
|
||||
|
||||
if (md5_value == hashlib.md5(packed_bytes).digest()) and (
|
||||
salty_sha256_value
|
||||
== hashlib.pbkdf2_hmac("sha256", md5_value + packed_bytes, salt, 16)
|
||||
== hashlib.pbkdf2_hmac(
|
||||
"sha256",
|
||||
md5_value + packed_bytes,
|
||||
salt(hashlib.sha256(str(brotli.__version__).encode("gb18030"))),
|
||||
16,
|
||||
)
|
||||
):
|
||||
return dill.loads(
|
||||
brotli.decompress(packed_bytes),
|
||||
@@ -49,7 +54,10 @@ def enpack_llc_pack(sth: Any, to_dist: str):
|
||||
md5_value = hashlib.md5(packing_bytes).digest() # 长度 16
|
||||
|
||||
salty_sha256_value = hashlib.pbkdf2_hmac(
|
||||
"sha256", md5_value + packing_bytes, salt, 16
|
||||
"sha256",
|
||||
md5_value + packing_bytes,
|
||||
salt(hashlib.md5(salt(salt(brotli.__version__)))),
|
||||
16,
|
||||
) # 长度 32
|
||||
|
||||
with open(
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
伶伦转换器 版本检查组件
|
||||
Linglun Converter Version Checking Component
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
开源相关声明请见 仓库根目录下的 License.md
|
||||
Terms & Conditions: License.md in the root directory
|
||||
@@ -13,11 +13,11 @@ Terms & Conditions: License.md in the root directory
|
||||
|
||||
import requests
|
||||
|
||||
from .io import TrimLog, Sequence, Iterable, Callable, Optional, Dict, Union
|
||||
from .io import Callable, Dict, Iterable, Optional, Sequence, TrimLog, Union
|
||||
|
||||
|
||||
def is_ver_char(text: str) -> bool:
|
||||
return text.isnumeric() or text == "."
|
||||
return text.isnumeric() or text in ".-"
|
||||
|
||||
|
||||
def cut_ver_str(text: str) -> str:
|
||||
@@ -30,8 +30,12 @@ def cut_ver_str(text: str) -> str:
|
||||
while is_ver_char(text[j]) and j < len_of_text:
|
||||
j += 1
|
||||
temp_str = text[i:j].strip()
|
||||
if ("." in temp_str) and (temp_str[0] != ".") and (temp_str[-1] != "."):
|
||||
return temp_str
|
||||
if (
|
||||
("." in temp_str or "-" in temp_str)
|
||||
and (temp_str[0] not in ".-")
|
||||
and (temp_str[-1] not in ".-")
|
||||
):
|
||||
return temp_str.replace("-", ".")
|
||||
i = j
|
||||
i += 1
|
||||
return ""
|
||||
@@ -48,8 +52,12 @@ def get_ver_str(text: str) -> Iterable[str]:
|
||||
while is_ver_char(text[j]) and j < len_of_text:
|
||||
j += 1
|
||||
temp_str = text[i:j].strip()
|
||||
if ("." in temp_str) and (temp_str[0] != ".") and (temp_str[-1] != "."):
|
||||
all_ver_str.append(temp_str)
|
||||
if (
|
||||
("." in temp_str or "-" in temp_str)
|
||||
and (temp_str[0] not in ".-")
|
||||
and (temp_str[-1] not in ".-")
|
||||
):
|
||||
all_ver_str.append(temp_str.replace("-", "."))
|
||||
i = j
|
||||
i += 1
|
||||
return all_ver_str
|
||||
@@ -78,7 +86,7 @@ def check_update_repo(
|
||||
if not version_disp:
|
||||
version_disp = version_now
|
||||
|
||||
logger.info("当前 {} 版本:{}".format(appname,version_now))
|
||||
logger.info("当前 {} 版本:{}".format(appname, version_now))
|
||||
try:
|
||||
code_content: str = requests.get(get_text_url).text
|
||||
except Exception as E: # noinspection PyBroadException
|
||||
@@ -89,7 +97,7 @@ def check_update_repo(
|
||||
code_content = code_content[code_content.find('"') + 1 :]
|
||||
version_content = code_content[: code_content.find('"')]
|
||||
|
||||
logger.info("已获取 {} 新版本信息:{}".format(appname,version_content))
|
||||
logger.info("已获取 {} 新版本信息:{}".format(appname, version_content))
|
||||
|
||||
if is_ver_bigger(
|
||||
[int(v) for v in cut_ver_str(version_content).split(".")],
|
||||
@@ -130,7 +138,7 @@ def check_update_release(
|
||||
version_renew_tip: str = "!有新版本!\n最新的 {app} 已经是 {latest} 版本,当前您正在使用的仍是 {current} 版本,是否更新?",
|
||||
) -> Union[None, Dict[str, str]]:
|
||||
|
||||
logger.info("当前 {} 版本:{}".format(appname,version_now))
|
||||
logger.info("当前 {} 版本:{}".format(appname, version_now))
|
||||
try:
|
||||
code_content: Dict = requests.get(get_release_url).json()
|
||||
except Exception as E: # noinspection PyBroadException
|
||||
@@ -139,7 +147,7 @@ def check_update_release(
|
||||
|
||||
version_content = code_content["release"]["tag"]["name"]
|
||||
|
||||
logger.info("已获取 {} 新版本信息:{}".format(appname,version_content))
|
||||
logger.info("已获取 {} 新版本信息:{}".format(appname, version_content))
|
||||
|
||||
if is_ver_bigger(
|
||||
[int(v) for v in cut_ver_str(version_content).split(".")],
|
||||
@@ -150,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(
|
||||
[
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
伶伦转换器 HTML页组件
|
||||
Linglun Converter HTML Component
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
开源相关声明请见 仓库根目录下的 License.md
|
||||
Terms & Conditions: License.md in the root directory
|
||||
@@ -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)
|
||||
|
||||
@@ -4,8 +4,8 @@
|
||||
伶伦转换器 言论版组件
|
||||
Linglun Converter Yan Lun Component
|
||||
|
||||
版权所有 © 2024 金羿
|
||||
Copyright © 2024 EillesWan
|
||||
版权所有 © 2025 金羿
|
||||
Copyright © 2025 EillesWan
|
||||
|
||||
开源相关声明请见 仓库根目录下的 License.md
|
||||
Terms & Conditions: License.md in the root directory
|
||||
@@ -19,15 +19,16 @@ 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("获取 言·论 信息……")
|
||||
|
||||
solar_datetime = zhDateTime.DateTime.now()
|
||||
lunar_datetime = solar_datetime.to_lunar()
|
||||
lunar_datetime = solar_datetime.to_chinese_format()
|
||||
solar_date = (solar_datetime.month, solar_datetime.day)
|
||||
lunar_date = (lunar_datetime.lunar_month, lunar_datetime.lunar_day)
|
||||
lunar_date = (
|
||||
lunar_datetime.chinese_calendar_month,
|
||||
lunar_datetime.chinese_calendar_day,
|
||||
)
|
||||
|
||||
if solar_date == (4, 3):
|
||||
yanlun_texts = ["金羿ELS 生日快乐~!", "Happy Birthday, Eilles!"]
|
||||
@@ -40,7 +41,7 @@ else:
|
||||
try:
|
||||
yanlun_texts = (
|
||||
requests.get(
|
||||
"https://nd.liteyuki.icu/api/v3/share/content/Xpue?path=null",
|
||||
"https://nd.liteyuki.org/api/v3/share/content/Xpue?path=null",
|
||||
)
|
||||
.text.strip("\n")
|
||||
.split("\n")
|
||||
@@ -52,3 +53,5 @@ else:
|
||||
except BaseException as E:
|
||||
logger.warning(f"读取言·论信息发生 未知 错误:\n{E}")
|
||||
yanlun_texts = ["灵光焕发 深艺献心"]
|
||||
|
||||
logger.info("已获取言·论 {} 条".format(len(yanlun_texts)))
|
||||
|
||||
Reference in New Issue
Block a user