diff --git a/qitv-windows.spec b/qitv-windows.spec index 4e7df11..6671ef1 100644 --- a/qitv-windows.spec +++ b/qitv-windows.spec @@ -1,44 +1,42 @@ -import site -import os +# -*- mode: python ; coding: utf-8 -*- -PACKAGES_PATH = site.getsitepackages()[0] -VLC_PATH = 'C:\\Program Files\\VideoLAN\\VLC' # Adjust this path if necessary +VLC_PATH = 'C:\\Program Files\\VideoLAN\\VLC' block_cipher = None a = Analysis( ['main.py'], - pathex=[], + pathex=[VLC_PATH], #insert your base VLC path here, ex: pathex=["D:\KivySchool\VLC"], binaries=[ - (os.path.join(VLC_PATH, 'libvlc.dll'), '.'), - (os.path.join(VLC_PATH, 'libvlccore.dll'), '.'), - (os.path.join(VLC_PATH, 'axvlc.dll'), '.'), - (os.path.join(VLC_PATH, 'npvlc.dll'), '.'), - ], - datas=[ - ('assets/qitv.ico', 'assets/qitv.ico') + (os.path.join(VLC_PATH, 'plugins/*'), 'plugins'), ], + datas=[], hiddenimports=[], hookspath=[], + hooksconfig={}, runtime_hooks=[], excludes=[], - win_no_prefer_redirects=False, - win_private_assemblies=False, - cipher=block_cipher, - noarchive=False + noarchive=False, ) -pyz = PYZ(a.pure, a.zipped_data, cipher=block_cipher) +pyz = PYZ(a.pure) exe = EXE( pyz, a.scripts, - a.binaries, - a.zipfiles, + a.binaries + [("libVLC.dll", os.path.join(VLC_PATH, 'libVLC.dll'), "BINARY")], a.datas, [], name='qitv.exe', debug=False, + bootloader_ignore_signals=False, strip=False, upx=True, + upx_exclude=[], + runtime_tmpdir=None, console=False, + disable_windowed_traceback=False, + argv_emulation=False, + target_arch=None, + codesign_identity=None, + entitlements_file=None, icon='assets/qitv.ico' ) diff --git a/video_player.py b/video_player.py index 04f2a39..000887d 100644 --- a/video_player.py +++ b/video_player.py @@ -1,11 +1,10 @@ -import sys -import vlc import json import platform -from PyQt5.QtWidgets import QApplication, QMainWindow, QVBoxLayout, QFrame, QWidget -from PyQt5.QtGui import QPalette, QColor + +import vlc from PyQt5.QtCore import Qt -import os +from PyQt5.QtGui import QPalette, QColor +from PyQt5.QtWidgets import QMainWindow, QVBoxLayout, QWidget class VideoPlayer(QMainWindow): @@ -18,59 +17,8 @@ def __init__(self): palette.setColor(QPalette.Window, QColor(0, 0, 0)) self.setPalette(palette) - if platform.system() == "Windows": - if getattr(sys, 'frozen', False): - vlc_dir = sys._MEIPASS # Temporary extraction path used by PyInstaller - else: - vlc_dir = os.path.dirname(os.path.abspath(__file__)) - - # Ensure the VLC path is set in the environment - libvlc_path = os.path.join(vlc_dir, 'libvlc.dll') - libvlccore_path = os.path.join(vlc_dir, 'libvlccore.dll') - - # Log paths for debugging - print(f"VLC Path: {libvlc_path}") - print(f"VLC Core Path: {libvlccore_path}") - - # Ensure the paths are set correctly - os.environ['PYTHON_VLC_LIB_PATH'] = vlc_dir - - if platform.system() == "Linux": - if getattr(sys, 'frozen', False): - vlc_dir = sys._MEIPASS # Temporary extraction path used by PyInstaller - else: - vlc_dir = os.path.dirname(os.path.abspath(__file__)) - # Ensure the VLC path is set in the environment - libvlc_path = os.path.join(vlc_dir, 'libvlc.so') - libvlccore_path = os.path.join(vlc_dir, 'libvlccore.so') - - # Log paths for debugging - print(f"VLC Path: {libvlc_path}") - print(f"VLC Core Path: {libvlccore_path}") - - # Ensure the paths are set correctly - os.environ['PYTHON_VLC_LIB_PATH'] = vlc_dir - if platform.system() == "Darwin": - if getattr(sys, 'frozen', False): - vlc_dir = sys._MEIPASS # Temporary extraction path used by PyInstaller - else: - vlc_dir = os.path.dirname(os.path.abspath(__file__)) - # Ensure the VLC path is set in the environment - libvlc_path = os.path.join(vlc_dir, 'libvlc.dylib') - libvlccore_path = os.path.join(vlc_dir, 'libvlccore.dylib') - - # Log paths for debugging - print(f"VLC Path: {libvlc_path}") - print(f"VLC Core Path: {libvlccore_path}") - - # Ensure the paths are set correctly - os.environ['PYTHON_VLC_LIB_PATH'] = vlc_dir - - # Initialize VLC instance try: - self.instance = vlc.Instance(['--plugin-path', vlc_dir]) - if not self.instance: - raise Exception("Failed to create VLC instance") + self.instance = vlc.Instance() except Exception as e: print(f"Exception occurred while creating VLC instance: {e}") raise