[media.mpv] media.mpv.play should toggle pause when called with no resource.

This commit is contained in:
Fabio Manganiello 2024-10-22 02:55:35 +02:00
parent c04aaba2bc
commit 1626fc737e
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -185,7 +185,7 @@ class MediaMpvPlugin(MediaPlugin):
@action @action
def play( def play(
self, self,
resource: str, resource: Optional[str] = None,
*_, *_,
subtitles: Optional[str] = None, subtitles: Optional[str] = None,
fullscreen: Optional[bool] = None, fullscreen: Optional[bool] = None,
@ -211,6 +211,10 @@ class MediaMpvPlugin(MediaPlugin):
:param metadata: Optional metadata to attach to the resource. :param metadata: Optional metadata to attach to the resource.
""" """
if not resource:
self.pause()
return self.status()
self._post_event(MediaPlayRequestEvent, resource=resource) self._post_event(MediaPlayRequestEvent, resource=resource)
if fullscreen is not None: if fullscreen is not None:
args['fs'] = fullscreen args['fs'] = fullscreen