- Fix crash after CD ripping (running QThread was destroyed) - Audio CDs always use mpv (bundled on Windows) even when Qt is the main engine — fixes 'several tracks failed to play' on Windows - YouTube/SoundCloud/Bandcamp links resolved with bundled yt-dlp - Lyrics: Auto prefers synced from any source (LRCLIB > NetEase > embedded > local); explicit choices no longer fall back; NetEase uses cloudsearch (search/get/web is encrypted outside China) - Playlist export uses absolute paths by default; import remaps paths from other machines/OSes via the library - HTTPS: certificate fallback (system bundles, certifi) for packaged builds; cover search shows real errors, more fallbacks, Last.fm covers - MusicBrainz: retry without album, cleaner album artist, async genre - CI self-tests require bundled libmpv (Windows), yt-dlp and TLS certs Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01J7imThHV9BMkG24GaxPDeq
80 lines
3.3 KiB
Python
80 lines
3.3 KiB
Python
# PyInstaller spec — build with: pyinstaller packaging/mulberry.spec --noconfirm
|
|
import os
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
ROOT = Path(SPECPATH).resolve().parent
|
|
IS_WIN = sys.platform == "win32"
|
|
icon_dir = ROOT / "packaging" / "build-icons"
|
|
|
|
datas = [(str(ROOT / "mulberry" / "assets"), "mulberry/assets")]
|
|
binaries = []
|
|
# libmpv for Windows (CI downloads it into packaging/windows/mpv/)
|
|
mpv_dir = ROOT / "packaging" / "windows" / "mpv"
|
|
if IS_WIN and mpv_dir.is_dir():
|
|
for f in mpv_dir.glob("*.dll"):
|
|
binaries.append((str(f), "."))
|
|
|
|
hidden = ["mulberry.winmedia", "mulberry.mpris", "mutagen", "numpy", "mpv", "certifi", "yt_dlp",
|
|
"PyQt6.QtMultimedia", "PyQt6.QtSvg", "PyQt6.QtNetwork"]
|
|
if not IS_WIN:
|
|
hidden.append("PyQt6.QtDBus")
|
|
|
|
excludes = ["PyQt6.QtWebEngineCore", "PyQt6.QtWebEngineWidgets", "PyQt6.QtQuick", "PyQt6.QtQml",
|
|
"PyQt6.Qt3DCore", "PyQt6.QtCharts", "PyQt6.QtDataVisualization", "PyQt6.QtBluetooth",
|
|
"PyQt6.QtPdf", "PyQt6.QtSql", "PyQt6.QtTest", "PyQt6.QtDesigner", "tkinter",
|
|
"matplotlib", "PIL", "scipy"]
|
|
|
|
a = Analysis(
|
|
[str(ROOT / "packaging" / "launcher.py")],
|
|
pathex=[str(ROOT)],
|
|
binaries=binaries,
|
|
datas=datas,
|
|
hiddenimports=hidden,
|
|
excludes=excludes,
|
|
noarchive=False,
|
|
)
|
|
# On Linux, libmpv (and its ~100 codec deps) must come from the system, not
|
|
# the bundle: drop it and everything only it pulls in.
|
|
if not IS_WIN:
|
|
import re
|
|
import subprocess
|
|
keep_basic = re.compile(r"^(libz|libssl|libcrypto|libffi|libexpat|liblzma|libbz2|libstdc|libgcc|"
|
|
r"libpython|libuuid|libreadline|libncurses|libtinfo|libsqlite|libmpdec)")
|
|
mpv_deps = set()
|
|
try:
|
|
import ctypes.util
|
|
lib = ctypes.util.find_library("mpv")
|
|
if lib:
|
|
out = subprocess.run(["bash", "-c", f"ldd $(ldconfig -p | grep -m1 '{lib}' | awk '{{print $NF}}')"],
|
|
capture_output=True, text=True).stdout
|
|
mpv_deps = {ln.split()[0] for ln in out.splitlines() if "=>" in ln}
|
|
except Exception:
|
|
pass
|
|
|
|
def unwanted(name):
|
|
base = os.path.basename(name)
|
|
if base.startswith("libmpv"):
|
|
return True
|
|
return base in mpv_deps and not keep_basic.match(base)
|
|
a.binaries = [b for b in a.binaries if not (unwanted(b[0]) and "PyQt6" not in b[1] and "numpy" not in b[1])]
|
|
|
|
# Qt modules Mulberry never uses (pulled in by plugins) — keeps the bundle lean
|
|
# Qt modules Mulberry never uses. NOTE: Qt6Quick/Qml/QmlModels must stay —
|
|
# the FFmpeg multimedia plugin links against them (dropping them silently
|
|
# disables all playback and decoding).
|
|
_drop = re.compile(r"(Qt6(Pdf|VirtualKeyboard|3D|WebEngine|Designer)|libqgtk3|qpdf|libgtk-3|libgdk-3)", re.I)
|
|
a.binaries = [b for b in a.binaries if not _drop.search(b[0])]
|
|
a.datas = [d for d in a.datas if not _drop.search(d[0])]
|
|
|
|
pyz = PYZ(a.pure)
|
|
exe = EXE(
|
|
pyz, a.scripts, [],
|
|
exclude_binaries=True,
|
|
name="Mulberry" if IS_WIN else "mulberry",
|
|
console=False,
|
|
icon=str(icon_dir / "mulberry.ico") if (IS_WIN and (icon_dir / "mulberry.ico").exists()) else None,
|
|
version=str(ROOT / "packaging" / "windows" / "version.txt") if IS_WIN else None,
|
|
)
|
|
coll = COLLECT(exe, a.binaries, a.datas, strip=False, upx=False, name="Mulberry")
|