Replace pyglet with QtMultimedia for audio playback

Removed pyglet dependency and migrated notification sound playback to use PySide6.QtMultimedia's QMediaPlayer and QAudioOutput. Updated workflow and requirements files to remove pyglet and ensure PySide6.QtMultimedia is included in build steps.
This commit is contained in:
oop7
2026-01-24 16:25:52 +02:00
parent d5d7a0186d
commit 64560fabb2
5 changed files with 13 additions and 13 deletions
+1 -2
View File
@@ -107,11 +107,11 @@ jobs:
"PySide6.QtCore", "PySide6.QtCore",
"PySide6.QtGui", "PySide6.QtGui",
"PySide6.QtWidgets", "PySide6.QtWidgets",
"PySide6.QtMultimedia",
"requests", "requests",
"PIL", "PIL",
"packaging", "packaging",
"markdown", "markdown",
"pyglet",
"loguru", "loguru",
"setuptools", "setuptools",
], ],
@@ -125,7 +125,6 @@ jobs:
"PySide6.QtXml", "PySide6.QtXml",
"PySide6.QtSql", "PySide6.QtSql",
"PySide6.QtHelp", "PySide6.QtHelp",
"PySide6.QtMultimedia",
"PySide6.QtQml", "PySide6.QtQml",
"PySide6.QtQuick", "PySide6.QtQuick",
"PySide6.QtWebEngineCore", "PySide6.QtWebEngineCore",
+1 -2
View File
@@ -92,11 +92,11 @@ jobs:
"PySide6.QtCore", "PySide6.QtCore",
"PySide6.QtGui", "PySide6.QtGui",
"PySide6.QtWidgets", "PySide6.QtWidgets",
"PySide6.QtMultimedia",
"requests", "requests",
"PIL", "PIL",
"packaging", "packaging",
"markdown", "markdown",
"pyglet",
"loguru", "loguru",
"setuptools", "setuptools",
], ],
@@ -110,7 +110,6 @@ jobs:
"PySide6.QtXml", "PySide6.QtXml",
"PySide6.QtSql", "PySide6.QtSql",
"PySide6.QtHelp", "PySide6.QtHelp",
"PySide6.QtMultimedia",
"PySide6.QtQml", "PySide6.QtQml",
"PySide6.QtQuick", "PySide6.QtQuick",
"PySide6.QtWebEngineCore", "PySide6.QtWebEngineCore",
+1 -2
View File
@@ -85,11 +85,11 @@ jobs:
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtCore",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtCore",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtGui",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtGui",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtWidgets",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtWidgets",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtMultimedia",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "requests",' Add-Content -Path "setup_cxfreeze.py" -Value ' "requests",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PIL",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PIL",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "packaging",' Add-Content -Path "setup_cxfreeze.py" -Value ' "packaging",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "markdown",' Add-Content -Path "setup_cxfreeze.py" -Value ' "markdown",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "pyglet",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "loguru",' Add-Content -Path "setup_cxfreeze.py" -Value ' "loguru",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "setuptools",' Add-Content -Path "setup_cxfreeze.py" -Value ' "setuptools",'
Add-Content -Path "setup_cxfreeze.py" -Value " ]," Add-Content -Path "setup_cxfreeze.py" -Value " ],"
@@ -103,7 +103,6 @@ jobs:
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtXml",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtXml",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtSql",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtSql",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtHelp",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtHelp",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtMultimedia",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtQml",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtQml",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtQuick",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtQuick",'
Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtWebEngineCore",' Add-Content -Path "setup_cxfreeze.py" -Value ' "PySide6.QtWebEngineCore",'
-1
View File
@@ -3,6 +3,5 @@ requests>=2.32.5
pillow>=12.0.0 pillow>=12.0.0
packaging>=25.0 packaging>=25.0
markdown>=3.10 markdown>=3.10
pyglet>=2.1.11
loguru>=0.7.3 loguru>=0.7.3
setuptools>=80.9.0 setuptools>=80.9.0
+10 -6
View File
@@ -5,11 +5,11 @@ import webbrowser
from pathlib import Path from pathlib import Path
import markdown import markdown
import pyglet
import requests import requests
from packaging import version from packaging import version
from PySide6.QtCore import Q_ARG, QMetaObject, Qt, QTimer, Slot, QThread, Signal from PySide6.QtCore import Q_ARG, QMetaObject, Qt, QTimer, Slot, QThread, Signal, QUrl
from PySide6.QtGui import QIcon from PySide6.QtGui import QIcon
from PySide6.QtMultimedia import QAudioOutput, QMediaPlayer
from PySide6.QtWidgets import ( from PySide6.QtWidgets import (
QApplication, QApplication,
QButtonGroup, QButtonGroup,
@@ -154,6 +154,11 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin, AnalysisMixin):
# Track if video analysis is completed # Track if video analysis is completed
self.analysis_completed = False self.analysis_completed = False
# Initialize audio player
self.player = QMediaPlayer()
self.audio_output = QAudioOutput()
self.player.setAudioOutput(self.audio_output)
self.init_ui() self.init_ui()
# Defer heavy start-up tasks to ensure UI renders immediately # Defer heavy start-up tasks to ensure UI renders immediately
@@ -208,10 +213,9 @@ class YTSageApp(QMainWindow, FormatTableMixin, VideoInfoMixin, AnalysisMixin):
logger.warning(f"Notification sound file not found at: {SOUND_PATH}") logger.warning(f"Notification sound file not found at: {SOUND_PATH}")
return return
# Play the sound using pyglet # Play the sound using QtMultimedia
# no need for the thread, as .play() is async self.player.setSource(QUrl.fromLocalFile(str(SOUND_PATH)))
sound = pyglet.media.load(str(SOUND_PATH), streaming=False) self.player.play()
sound.play()
logger.debug("Notification sound played") logger.debug("Notification sound played")
except Exception as e: except Exception as e:
logger.exception(f"Error playing notification sound: {e}") logger.exception(f"Error playing notification sound: {e}")