From 1626fc737e1473ab8d88908acb98e9130e4dc385 Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Tue, 22 Oct 2024 02:55:35 +0200 Subject: [PATCH] [media.mpv] media.mpv.play should toggle pause when called with no resource. --- platypush/plugins/media/mpv/__init__.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/platypush/plugins/media/mpv/__init__.py b/platypush/plugins/media/mpv/__init__.py index 7159985342..4ed5ed7b59 100644 --- a/platypush/plugins/media/mpv/__init__.py +++ b/platypush/plugins/media/mpv/__init__.py @@ -185,7 +185,7 @@ class MediaMpvPlugin(MediaPlugin): @action def play( self, - resource: str, + resource: Optional[str] = None, *_, subtitles: Optional[str] = None, fullscreen: Optional[bool] = None, @@ -211,6 +211,10 @@ class MediaMpvPlugin(MediaPlugin): :param metadata: Optional metadata to attach to the resource. """ + if not resource: + self.pause() + return self.status() + self._post_event(MediaPlayRequestEvent, resource=resource) if fullscreen is not None: args['fs'] = fullscreen