Videre
This commit is contained in:
161
LineDancePlayer.spec
Normal file
161
LineDancePlayer.spec
Normal file
@@ -0,0 +1,161 @@
|
||||
# -*- mode: python ; coding: utf-8 -*-
|
||||
#
|
||||
# LineDancePlayer.spec
|
||||
#
|
||||
# Byg med: pyinstaller LineDancePlayer.spec
|
||||
# Output: dist\LineDancePlayer.exe
|
||||
#
|
||||
# Kræver: VLC installeret på byggemaskinen
|
||||
# (typisk C:\Program Files\VideoLAN\VLC)
|
||||
|
||||
import os
|
||||
import sys
|
||||
from pathlib import Path
|
||||
|
||||
# ── Find VLC-installation ─────────────────────────────────────────────────────
|
||||
|
||||
def find_vlc_path() -> Path | None:
|
||||
"""Find VLC på Windows — tjekker de mest almindelige installationsstier."""
|
||||
candidates = [
|
||||
Path(os.environ.get("PROGRAMFILES", "C:/Program Files")) / "VideoLAN" / "VLC",
|
||||
Path(os.environ.get("PROGRAMFILES(X86)", "C:/Program Files (x86)")) / "VideoLAN" / "VLC",
|
||||
Path("C:/Program Files/VideoLAN/VLC"),
|
||||
Path("C:/Program Files (x86)/VideoLAN/VLC"),
|
||||
]
|
||||
# Tjek også PYTHONPATH og registry via python-vlc
|
||||
try:
|
||||
import vlc
|
||||
vlc_path = Path(vlc.plugin_path).parent if vlc.plugin_path else None
|
||||
if vlc_path and vlc_path.exists():
|
||||
candidates.insert(0, vlc_path)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
for path in candidates:
|
||||
if path.exists() and (path / "libvlc.dll").exists():
|
||||
return path
|
||||
return None
|
||||
|
||||
|
||||
VLC_PATH = find_vlc_path()
|
||||
if VLC_PATH is None:
|
||||
print("=" * 60)
|
||||
print("ADVARSEL: VLC ikke fundet!")
|
||||
print("Installer VLC fra https://www.videolan.org/vlc/")
|
||||
print("og kør pyinstaller igen.")
|
||||
print("=" * 60)
|
||||
VLC_PATH = Path("C:/Program Files/VideoLAN/VLC") # fallback
|
||||
|
||||
print(f"VLC fundet: {VLC_PATH}")
|
||||
|
||||
# ── Saml VLC binære filer ─────────────────────────────────────────────────────
|
||||
|
||||
vlc_binaries = []
|
||||
vlc_datas = []
|
||||
|
||||
if VLC_PATH.exists():
|
||||
# Hoved-DLL filer
|
||||
for dll in ["libvlc.dll", "libvlccore.dll", "libvlc.lib"]:
|
||||
dll_path = VLC_PATH / dll
|
||||
if dll_path.exists():
|
||||
vlc_binaries.append((str(dll_path), "."))
|
||||
|
||||
# Plugins-mappe — indeholder codecs, demuxers osv.
|
||||
plugins_dir = VLC_PATH / "plugins"
|
||||
if plugins_dir.exists():
|
||||
vlc_datas.append((str(plugins_dir), "plugins"))
|
||||
|
||||
# Locale-filer
|
||||
locale_dir = VLC_PATH / "locale"
|
||||
if locale_dir.exists():
|
||||
vlc_datas.append((str(locale_dir), "locale"))
|
||||
|
||||
# ── PyInstaller konfiguration ─────────────────────────────────────────────────
|
||||
|
||||
block_cipher = None
|
||||
|
||||
a = Analysis(
|
||||
["main.py"],
|
||||
pathex=["."],
|
||||
binaries=vlc_binaries,
|
||||
datas=[
|
||||
("ui", "ui"),
|
||||
("local", "local"),
|
||||
("player", "player"),
|
||||
] + vlc_datas,
|
||||
hiddenimports=[
|
||||
# PyQt6
|
||||
"PyQt6.sip",
|
||||
"PyQt6.QtCore",
|
||||
"PyQt6.QtGui",
|
||||
"PyQt6.QtWidgets",
|
||||
# Lyd og tags
|
||||
"vlc",
|
||||
"mutagen",
|
||||
"mutagen.mp3",
|
||||
"mutagen.id3",
|
||||
"mutagen.flac",
|
||||
"mutagen.mp4",
|
||||
"mutagen.oggvorbis",
|
||||
"mutagen.oggopus",
|
||||
# Fil-overvågning
|
||||
"watchdog",
|
||||
"watchdog.observers",
|
||||
"watchdog.observers.polling",
|
||||
"watchdog.events",
|
||||
# Database
|
||||
"sqlite3",
|
||||
# Standard
|
||||
"json",
|
||||
"pathlib",
|
||||
"threading",
|
||||
"urllib.request",
|
||||
"urllib.parse",
|
||||
],
|
||||
hookspath=[],
|
||||
hooksconfig={},
|
||||
runtime_hooks=[],
|
||||
excludes=[
|
||||
# Ting vi ikke bruger — reducerer filstørrelse
|
||||
"tkinter",
|
||||
"matplotlib",
|
||||
"numpy",
|
||||
"pandas",
|
||||
"scipy",
|
||||
"PIL",
|
||||
"cv2",
|
||||
"pytest",
|
||||
],
|
||||
win_no_prefer_redirects=False,
|
||||
win_private_assemblies=False,
|
||||
cipher=block_cipher,
|
||||
noarchive=False,
|
||||
)
|
||||
|
||||
pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher)
|
||||
|
||||
exe = EXE(
|
||||
pyz,
|
||||
a.scripts,
|
||||
a.binaries,
|
||||
a.zipfiles,
|
||||
a.datas,
|
||||
[],
|
||||
name="LineDancePlayer",
|
||||
debug=False,
|
||||
bootloader_ignore_signals=False,
|
||||
strip=False,
|
||||
upx=True, # komprimer med UPX hvis tilgængeligt
|
||||
upx_exclude=[
|
||||
"libvlc.dll", # VLC må ikke komprimeres — den loader plugins dynamisk
|
||||
"libvlccore.dll",
|
||||
],
|
||||
runtime_tmpdir=None,
|
||||
console=False, # ingen konsol-vindue
|
||||
disable_windowed_traceback=False,
|
||||
target_arch=None,
|
||||
codesign_identity=None,
|
||||
entitlements_file=None,
|
||||
# Ikon — kommenter ud hvis du ikke har en .ico fil endnu
|
||||
# icon="assets/icon.ico",
|
||||
)
|
||||
Reference in New Issue
Block a user