After around 1.5h of operation, we'd get messages such as: vlcpulse audio output error: PulseAudio server connection failure: Connection terminated Tracked down to not correctly releasing vlc player resources when track had finished playing. Fixed now, and much simplified the fadeout code as well.
30 lines
652 B
Python
30 lines
652 B
Python
# Standard library imports
|
|
|
|
# PyQt imports
|
|
|
|
# Third party imports
|
|
import vlc # type: ignore
|
|
|
|
# App imports
|
|
|
|
|
|
class VLCManager:
|
|
"""
|
|
Singleton class to ensure we only ever have one vlc Instance
|
|
"""
|
|
|
|
__instance = None
|
|
|
|
def __init__(self) -> None:
|
|
if VLCManager.__instance is None:
|
|
self.vlc_instance = vlc.Instance()
|
|
VLCManager.__instance = self
|
|
else:
|
|
raise Exception("Attempted to create a second VLCManager instance")
|
|
|
|
@staticmethod
|
|
def get_instance() -> vlc.Instance:
|
|
if VLCManager.__instance is None:
|
|
VLCManager()
|
|
return VLCManager.__instance
|