This commit is contained in:
nose
2025-11-26 00:29:10 -08:00
parent 935ce303d0
commit e9b505e609
4 changed files with 33 additions and 38 deletions

View File

@@ -127,6 +127,17 @@ def _run(result: Any, args: Sequence[str], config: Dict[str, Any]) -> int:
else:
debug("Failed to pause playback (MPV not running?)", file=sys.stderr)
return 1
# Handle Clear All command (no index provided)
if clear_mode and index_arg is None:
cmd = {"command": ["playlist-clear"], "request_id": 105}
resp = _send_ipc_command(cmd)
if resp and resp.get("error") == "success":
debug("Playlist cleared")
return 0
else:
debug("Failed to clear playlist (MPV not running?)", file=sys.stderr)
return 1
# Handle piped input (add to playlist)
if result:
@@ -366,7 +377,7 @@ CMDLET = Cmdlet(
CmdletArg(
name="clear",
type="flag",
description="Remove the selected item from the playlist"
description="Remove the selected item, or clear entire playlist if no index provided"
),
CmdletArg(
name="list",