From e890954a8eee0b0d354211aaf8b8b6c9bcbe9add Mon Sep 17 00:00:00 2001 From: Ion Reguera Date: Tue, 29 Sep 2026 12:08:36 +0200 Subject: [PATCH] refactor(players): delete dead VideoPlayer that restarted a unit that does not exist (869f8v8yv) VideoPlayer was never instantiated, and its own docstring said not to use it. Its run() restarted 'videocomposer.service'; the real unit is cuems-videocomposer.service. Deleted rather than fixed: a working restart would cut live video and leave the engine holding layers the fresh videocomposer no longer has (869f8jn34), against the never-auto-stop rule. Also drops CueHandler._video_players and _front_video_player, written in __new__ and never read, and the stale 'VideoPlayer was called' assertion in testdev_engines_communication.py (not collected by pytest). Co-Authored-By: Claude --- src/cuemsengine/cues/CueHandler.py | 5 ----- src/cuemsengine/players/VideoPlayer.py | 26 +------------------------- src/cuemsengine/players/__init__.py | 4 ++-- tests/test_action_cue.py | 2 -- tests/testdev_engines_communication.py | 6 ++++-- 5 files changed, 7 insertions(+), 36 deletions(-) diff --git a/src/cuemsengine/cues/CueHandler.py b/src/cuemsengine/cues/CueHandler.py index e8b3f159..b49f9a26 100644 --- a/src/cuemsengine/cues/CueHandler.py +++ b/src/cuemsengine/cues/CueHandler.py @@ -16,7 +16,6 @@ from cuemsutils.tools.CTimecode import CTimecode from ..comms.NodeCommunications import NodeCommunications -from ..players import VideoPlayer from ..players.PlayerHandler import PLAYER_HANDLER from ..tools import MtcListener from .ActionHandler import ACTION_HANDLER as _ACTION_HANDLER_SINGLETON @@ -54,8 +53,6 @@ class CueHandler: # Instance attributes (declared for IDE/type checker support) _armed_cues: list[Cue] _armed_cues_set: set[str] - _video_players: dict - _front_video_player: VideoPlayer | None _lock: Lock communications_thread: NodeCommunications @@ -65,8 +62,6 @@ def __new__(cls, *args, **kwargs): # Initialize instance attributes cls._instance._armed_cues = [] cls._instance._armed_cues_set = set() - cls._instance._video_players = {} - cls._instance._front_video_player = None cls._instance._lock = Lock() return cls._instance diff --git a/src/cuemsengine/players/VideoPlayer.py b/src/cuemsengine/players/VideoPlayer.py index c05c8491..b6949368 100644 --- a/src/cuemsengine/players/VideoPlayer.py +++ b/src/cuemsengine/players/VideoPlayer.py @@ -2,34 +2,10 @@ # SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileContributor: Ion Reguera # SPDX-FileContributor: AdriĆ  Masip -from cuemsutils.log import Logger, logged +from cuemsutils.log import Logger from ..osc.endpoints import OSC_VIDEOPLAYER_CONF, OSC_VIDEOPLAYER_LAYER_CONF from ..osc.OssiaClient import PlayerClient -from .Player import Player - - -class VideoPlayer(Player): - """Video player systemd service wrapper. - - This class restarts the videocomposer service. - - IMPORTANT: This class should not be used, since videocomposer is a systemd - service and not a subprocess. - """ - - def __init__(self): - super().__init__() - Logger.warning( - "Restarting the videocomposer service. Use VideoClient only to" - "control videocomposer." - ) - - @logged - def run(self): - process_call_list = ["systemctl", "restart", "videocomposer.service"] - Logger.info(f"Restarting videocomposer service: {process_call_list}") - self.call_subprocess(process_call_list) class VideoClient(PlayerClient): diff --git a/src/cuemsengine/players/__init__.py b/src/cuemsengine/players/__init__.py index 81b2ad02..2bda498c 100644 --- a/src/cuemsengine/players/__init__.py +++ b/src/cuemsengine/players/__init__.py @@ -1,10 +1,11 @@ # SPDX-FileCopyrightText: 2026 Stagelab Coop SCCL # SPDX-License-Identifier: GPL-3.0-or-later # SPDX-FileContributor: AdriĆ  Masip +# SPDX-FileContributor: Ion Reguera from .AudioPlayer import AudioClient, AudioPlayer from .DmxPlayer import DmxClient, DmxPlayer -from .VideoPlayer import VideoClient, VideoPlayer +from .VideoPlayer import VideoClient __all__ = [ "AudioClient", @@ -12,5 +13,4 @@ "DmxClient", "DmxPlayer", "VideoClient", - "VideoPlayer", ] diff --git a/tests/test_action_cue.py b/tests/test_action_cue.py index b44dfd44..e8ac9416 100644 --- a/tests/test_action_cue.py +++ b/tests/test_action_cue.py @@ -61,8 +61,6 @@ def handler(): h = object.__new__(CueHandler) h._armed_cues = [] h._armed_cues_set = set() - h._video_players = {} - h._front_video_player = None h._lock = __import__("threading").Lock() h.communications_thread = MagicMock() ACTION_HANDLER.bind_cue_handler(h) diff --git a/tests/testdev_engines_communication.py b/tests/testdev_engines_communication.py index 3d01c2e4..ab54a5f9 100644 --- a/tests/testdev_engines_communication.py +++ b/tests/testdev_engines_communication.py @@ -1,3 +1,7 @@ +# SPDX-FileCopyrightText: 2026 Stagelab Coop SCCL +# SPDX-License-Identifier: GPL-3.0-or-later +# SPDX-FileContributor: Ion Reguera + from logging import INFO from time import sleep from unittest.mock import patch @@ -82,8 +86,6 @@ def test_two_projects_load_from_controller( assert ( len(mock_player_subprocess) > 0 ), "Expected player subprocess calls to be recorded" - player_types = {call["player"] for call in mock_player_subprocess} - assert "VideoPlayer" in player_types, "Expected VideoPlayer to be called" # Verify each call has required fields for call in mock_player_subprocess: assert "player" in call