[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
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