🐛 | Fix tests
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m44s
All checks were successful
SonarQube Code Quality Scan / SonarQube Scan (push) Successful in 1m44s
This commit is contained in:
25
player.py
25
player.py
@@ -40,8 +40,29 @@ import threading
|
||||
from typing import Optional
|
||||
|
||||
import yt_dlp
|
||||
from PySide6.QtCore import QObject, QThread, Signal, Slot, QUrl
|
||||
from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
|
||||
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
# Qt imports are guarded so the module can be imported for its pure helper
|
||||
# functions (``_best_thumbnail``, ``_build_song_dict``, etc.) even when the
|
||||
# system lacks PulseAudio / EGL / other Qt multimedia native libraries.
|
||||
# The player classes (``AudioPlayer``, ``DownloadWorker``, ``SearchWorker``)
|
||||
# will **not** be functional in that case — they need the real Qt runtime.
|
||||
# ═══════════════════════════════════════════════════════════════════════════
|
||||
_HAS_QT = True
|
||||
try:
|
||||
from PySide6.QtCore import QObject, QThread, Signal, Slot, QUrl
|
||||
from PySide6.QtMultimedia import QMediaPlayer, QAudioOutput
|
||||
except (ImportError, OSError):
|
||||
_HAS_QT = False
|
||||
QObject = object
|
||||
QThread = type("QThread", (), {"start": lambda s: None,
|
||||
"quit": lambda s: None,
|
||||
"wait": lambda s, t=3000: True})
|
||||
Signal = lambda *a: lambda f: f
|
||||
Slot = lambda *a: lambda f: f
|
||||
QUrl = None
|
||||
QMediaPlayer = None
|
||||
QAudioOutput = None
|
||||
|
||||
log = logging.getLogger("tunetti.player")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user