-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from chenmozhijin/dev
v0.8.0
- Loading branch information
Showing
141 changed files
with
17,246 additions
and
6,735 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ on: | |
- dev | ||
paths: | ||
- "**.py" | ||
- ".github/workflows/build-nuitka.yml" | ||
- ".github/workflows/build.yml" | ||
workflow_dispatch: | ||
|
||
|
||
|
@@ -51,7 +51,7 @@ jobs: | |
- name: Install dependencies | ||
run: | | ||
pip install -r requirements.txt | ||
pip install -Ur requirements.txt | ||
pip install imageio | ||
- name: Install EGL/upx | ||
|
@@ -88,49 +88,94 @@ jobs: | |
run: | | ||
echo "copyright=Copyright (C) $(python build_helper.py --task get_year) 沉默の金" >> $GITHUB_OUTPUT | ||
echo "version=$(python build_helper.py --task get_version)" >> $GITHUB_OUTPUT | ||
echo "num_version=$(python build_helper.py --task get_num_version)" >> $GITHUB_OUTPUT | ||
echo "qt_translations_path=$(python build_helper.py --task get_qt_translations_path)" >> $GITHUB_OUTPUT | ||
cat $GITHUB_OUTPUT | ||
- name: Build Executable(Linux/macOS) | ||
- name: Build Executable(Linux) | ||
uses: Nuitka/Nuitka-Action@main | ||
if : ${{ runner.os == 'Linux' || runner.os == 'macOS'}} | ||
if : ${{ runner.os == 'Linux'}} | ||
with: | ||
nuitka-version: main | ||
script-name: LDDC.py | ||
standalone: true | ||
onefile: false | ||
script-name: LDDC | ||
|
||
mode: standalone | ||
report: nuitka-report.xml | ||
enable-plugins: pyside6 | ||
product-name: "LDDC" | ||
file-version: ${{ steps.info.outputs.version }} | ||
product-version: ${{ steps.info.outputs.version }} | ||
file-version: ${{ steps.info.outputs.num_version }} | ||
product-version: ${{ steps.info.outputs.num_version }} | ||
copyright: ${{ steps.info.outputs.copyright }} | ||
|
||
disable-console: true | ||
|
||
macos-app-icon: "res/img/icon/logo.icns" | ||
macos-app-version: ${{ steps.info.outputs.version }} | ||
macos-create-app-bundle: true | ||
macos-app-icon: "LDDC/res/img/icon/logo.icns" | ||
macos-app-version: ${{ steps.info.outputs.num_version }} | ||
macos-target-arch: ${{ steps.arch.outputs.nuitka_arch }} | ||
|
||
include-data-files: | | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_en.qm=PySide6/Qt/translations/qtbase_en.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_zh_CN.qm=PySide6/Qt/translations/qtbase_zh_CN.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_zh_TW.qm=PySide6/Qt/translations/qtbase_zh_TW.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_ja.qm=PySide6/Qt/translations/qtbase_ja.qm | ||
env: | ||
PYTHONPATH: ${{ github.workspace }} | ||
|
||
- name: Build Executable(macOS) | ||
uses: Nuitka/Nuitka-Action@main | ||
if : ${{ runner.os == 'macOS' }} | ||
with: | ||
nuitka-version: main | ||
script-name: LDDC | ||
|
||
mode: app | ||
report: nuitka-report.xml | ||
enable-plugins: pyside6 | ||
product-name: "LDDC" | ||
file-version: ${{ steps.info.outputs.num_version }} | ||
product-version: ${{ steps.info.outputs.num_version }} | ||
copyright: ${{ steps.info.outputs.copyright }} | ||
|
||
|
||
macos-app-icon: "LDDC/res/img/icon/logo.icns" | ||
macos-app-version: ${{ steps.info.outputs.num_version }} | ||
macos-target-arch: ${{ steps.arch.outputs.nuitka_arch }} | ||
|
||
include-data-files: | | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_en.qm=PySide6/Qt/translations/qtbase_en.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_zh_CN.qm=PySide6/Qt/translations/qtbase_zh_CN.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_zh_TW.qm=PySide6/Qt/translations/qtbase_zh_TW.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_ja.qm=PySide6/Qt/translations/qtbase_ja.qm | ||
env: | ||
PYTHONPATH: ${{ github.workspace }} | ||
|
||
- name: Build Executable(Windows) | ||
uses: Nuitka/Nuitka-Action@main | ||
if : ${{ runner.os == 'Windows' }} | ||
with: | ||
nuitka-version: main | ||
script-name: LDDC.py | ||
standalone: true | ||
onefile: false | ||
script-name: LDDC | ||
|
||
mode: standalone | ||
report: nuitka-report.xml | ||
enable-plugins: pyside6 | ||
product-name: "LDDC" | ||
file-version: ${{ steps.info.outputs.version }} | ||
product-version: ${{ steps.info.outputs.version }} | ||
file-version: ${{ steps.info.outputs.num_version }} | ||
product-version: ${{ steps.info.outputs.num_version }} | ||
copyright: ${{ steps.info.outputs.copyright }} | ||
|
||
windows-icon-from-ico: "res/img/icon/logo.ico" | ||
windows-icon-from-ico: "LDDC/res/img/icon/logo.ico" | ||
mingw64: true | ||
windows-console-mode: 'attach' | ||
|
||
include-data-files: | | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_en.qm=PySide6/translations/qtbase_en.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_zh_CN.qm=PySide6/translations/qtbase_zh_CN.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_zh_TW.qm=PySide6/translations/qtbase_zh_TW.qm | ||
${{ steps.info.outputs.qt_translations_path }}/qtbase_ja.qm=PySide6/translations/qtbase_ja.qm | ||
env: | ||
PYTHONPATH: ${{ github.workspace }} | ||
|
||
- name: Upload report | ||
uses: actions/upload-artifact@v4 | ||
if: success() || failure() | ||
|
@@ -145,7 +190,7 @@ jobs: | |
run: | | ||
create-dmg \ | ||
--volname "LDDC" \ | ||
--volicon "res/img/icon/logo.icns" \ | ||
--volicon "LDDC/res/img/icon/logo.icns" \ | ||
--window-pos 200 120 \ | ||
--window-size 800 400 \ | ||
--icon-size 100 \ | ||
|
@@ -156,6 +201,12 @@ jobs: | |
mv dist/LDDC.dmg upload/LDDC-${{ steps.info.outputs.version }}-${{ steps.arch.outputs.arch }}.dmg | ||
- name: Add fcitx5 support | ||
if: ${{ runner.os == 'Linux' }} | ||
uses: chenmozhijin/fcitx5-pyside@main | ||
with: | ||
plugins-path: ${{ github.workspace }}/build/LDDC.dist/PySide6/qt-plugins | ||
|
||
- name: create deb package | ||
if: ${{ runner.os == 'Linux' }} | ||
run: | | ||
|
@@ -165,20 +216,21 @@ jobs: | |
mkdir -p deb/usr/bin | ||
mkdir -p deb/usr/share/applications | ||
mkdir -p deb/usr/share/icons/ | ||
cp -r ../res/img/icon/logo.ico deb/usr/share/icons/LDDC.ico | ||
cp -r ../LDDC/res/img/icon/logo.ico deb/usr/share/icons/LDDC.ico | ||
cp -RT ../build/LDDC.dist deb/usr/lib/LDDC | ||
chmod +x deb/usr/lib/LDDC/LDDC.bin | ||
ln -s ../lib/LDDC/LDDC.bin deb/usr/bin/LDDC | ||
echo "Package: LDDC" >> deb/DEBIAN/control | ||
echo "Version: ${{ steps.info.outputs.version }}" >> deb/DEBIAN/control | ||
echo "Architecture: ${{ steps.arch.outputs.arch }}" >> deb/DEBIAN/control | ||
echo "Maintainer: chenmozhijin" >> deb/DEBIAN/control | ||
echo "Description: lyrics tool" >> deb/DEBIAN/control | ||
echo "Maintainer: chenmozhijin <[email protected]>" >> deb/DEBIAN/control | ||
echo "Description: Lyrics acquisition tool" >> deb/DEBIAN/control | ||
echo "Homepage: https://github.com/chenmozhijin/LDDC" >> deb/DEBIAN/control | ||
|
||
echo "[Desktop Entry]" >> deb/usr/share/applications/LDDC.desktop | ||
echo "Name=LDDC" >> deb/usr/share/applications/LDDC.desktop | ||
echo "Comment=lyrics tool" >> deb/usr/share/applications/LDDC.desktop | ||
echo "Comment=Lyrics acquisition tool" >> deb/usr/share/applications/LDDC.desktop | ||
echo "Exec=/usr/bin/LDDC" >> deb/usr/share/applications/LDDC.desktop | ||
echo "Icon=/usr/share/icons/LDDC.ico" >> deb/usr/share/applications/LDDC.desktop | ||
echo "Terminal=false" >> deb/usr/share/applications/LDDC.desktop | ||
|
@@ -260,3 +312,28 @@ jobs: | |
name: ${{ runner.os }} - ${{ matrix.arch }} artifacts | ||
path: | | ||
upload/ | ||
build-wheel: | ||
name: Build wheel | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -Ur requirements-dev.txt | ||
- name: Build wheel | ||
run: | | ||
python -m build | ||
- name: Upload | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: Wheel | ||
path: | | ||
dist/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
name: test LDDC | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
- dev | ||
paths: | ||
- "**.py" | ||
- ".github/workflows/test.yml" | ||
workflow_dispatch: | ||
|
||
jobs: | ||
|
||
test: | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
os: [macos-13, windows-latest] | ||
arch: [x64] | ||
include: | ||
- os: macos-latest | ||
arch: arm64 | ||
runs-on: ${{ matrix.os }} | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: 3.12 | ||
architecture: ${{ matrix.arch }} | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -Ur requirements-tests.txt | ||
pip install . | ||
- name: Install FFmpeg(Linux) | ||
if: runner.os == 'Linux' | ||
run: sudo apt-get update && sudo apt-get install -y ffmpeg | ||
|
||
- name: Install FFmpeg(Windows) | ||
if: runner.os == 'Windows' | ||
run: choco install ffmpeg -y | ||
|
||
- name: Install FFmpeg(Mac) | ||
if: runner.os == 'macOS' | ||
run: brew install ffmpeg | ||
|
||
- name: Install GUI dependencies | ||
if: runner.os == 'Linux' | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y qtbase5-dev libqt5gui5 libqt5widgets5 xvfb | ||
- name: Run tests | ||
run: | | ||
pytest --cov=LDDC --cov-report=xml --cov-report=html --cov-report=term --disable-warnings | ||
- name: Save test artifacts | ||
if: always() | ||
run: | | ||
mkdir -p tests/artifacts/reports | ||
cp -r htmlcov ./tests/artifacts/reports | ||
cp coverage.xml ./tests/artifacts/reports | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: always() | ||
with: | ||
name: artifacts-${{ matrix.os }} | ||
path: tests/artifacts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -142,4 +142,6 @@ test/ | |
plugins/ | ||
Logs/ | ||
|
||
update_ts.ps1 | ||
update_ts.ps1 | ||
|
||
tests/artifacts/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
# SPDX-FileCopyrightText: Copyright (C) 2024 沉默の金 <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
from .utils.version import __version__ # noqa: F401 | ||
|
||
__author__ = "沉默の金" | ||
__license__ = "GPL-3.0-only" | ||
__copyright__ = "Copyright (C) 2024 沉默の金 <[email protected]>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,28 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2024 沉默の金 <[email protected]> | ||
# SPDX-FileCopyrightText: Copyright (C) 2024 沉默の金 <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
import os | ||
import sys | ||
from importlib.util import find_spec | ||
|
||
from PySide6.QtCore import QThread | ||
from PySide6.QtWidgets import QApplication | ||
|
||
from backend.service import LDDCService | ||
from res import resource_rc | ||
from utils.args import args | ||
from utils.exit_manager import exit_manager | ||
from utils.translator import load_translation | ||
from utils.version import __version__ | ||
__author__ = "沉默の金" | ||
__license__ = "GPL-3.0-only" | ||
__copyright__ = "Copyright (C) 2024 沉默の金 <[email protected]>" | ||
name = "LDDC" # 程序名称(用于utils.args检查运行模式) | ||
if find_spec("LDDC") is None: | ||
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) | ||
# ruff: noqa: E402 | ||
from LDDC.backend.service import LDDCService | ||
from LDDC.res import resource_rc | ||
from LDDC.utils.args import args | ||
from LDDC.utils.exit_manager import exit_manager | ||
from LDDC.utils.translator import load_translation | ||
from LDDC.utils.version import __version__ | ||
|
||
resource_rc.qInitResources() | ||
|
||
|
||
if __name__ == "__main__": | ||
|
||
app = QApplication(sys.argv) | ||
|
@@ -23,8 +31,6 @@ | |
LDDCService() | ||
sys.exit() | ||
|
||
show = args.show | ||
|
||
# 启动服务线程 | ||
service = LDDCService() | ||
service_thread = QThread(app) | ||
|
@@ -36,14 +42,14 @@ | |
# 加载翻译 | ||
load_translation(False) | ||
# 显示主窗口(如果需要) | ||
if show: | ||
from view.main_window import main_window | ||
if args.show: | ||
from LDDC.view.main_window import main_window | ||
main_window.show() | ||
|
||
# 检查更新 | ||
from utils.data import cfg | ||
from LDDC.utils.data import cfg | ||
if cfg["auto_check_update"]: | ||
from view.update import check_update | ||
from LDDC.view.update import check_update | ||
check_update(True, QApplication.translate("CheckUpdate", "LDDC主程序"), "chenmozhijin/LDDC", __version__) | ||
|
||
# 进入事件循环 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# SPDX-FileCopyrightText: Copyright (C) 2024 沉默の金 <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-only |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
# SPDX-FileCopyrightText: Copyright (c) 2024 沉默の金 <[email protected]> | ||
# SPDX-FileCopyrightText: Copyright (C) 2024 沉默の金 <[email protected]> | ||
# SPDX-License-Identifier: GPL-3.0-only | ||
import json | ||
import random | ||
|
@@ -9,9 +9,9 @@ | |
|
||
import requests | ||
|
||
from utils.enum import SearchType, Source | ||
from utils.error import LyricsRequestError | ||
from utils.logger import DEBUG, logger | ||
from LDDC.utils.enum import SearchType, Source | ||
from LDDC.utils.error import LyricsRequestError | ||
from LDDC.utils.logger import DEBUG, logger | ||
|
||
from .decryptor.eapi import ( | ||
eapi_params_encrypt, | ||
|
@@ -696,7 +696,7 @@ def kg_get_songlist(listid: str | int, list_type: str) -> str | list: | |
if list_type not in ["album", "songlist"]: | ||
return "错误的list_type" | ||
|
||
domain = random.choice(["mobiles.kugou.com", "msearchcdn.kugou.com", "mobilecdnbj.kugou.com", "msearch.kugou.com"]) # noqa: S311 | ||
domain = random.choice(["mobiles.kugou.com", "mobilecdnbj.kugou.com"]) # noqa: S311 | ||
match list_type: | ||
case "album": | ||
url = f"http://{domain}/api/v3/album/song" | ||
|
Oops, something went wrong.