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

@@ -453,10 +453,10 @@ def _handle_search_result(result: Any, args: Sequence[str], config: Dict[str, An
if storage_name.lower() == 'hydrus':
return _handle_hydrus_file(file_hash, file_title, config, args, mime_type=mime_type)
elif storage_name.lower() == 'local':
return _handle_local_file(file_path, file_title, args, file_hash=file_hash)
return _handle_local_file(file_path, file_title, config, args, file_hash=file_hash)
elif storage_name.lower() == 'download':
# Downloads are local files
return _handle_local_file(file_path, file_title, args, file_hash=file_hash)
return _handle_local_file(file_path, file_title, config, args, file_hash=file_hash)
elif storage_name.lower() == 'debrid':
# Extract magnet_id from result (search-file stores it in full_metadata or as custom attribute)
if not magnet_id:
@@ -591,7 +591,7 @@ def _handle_hydrus_file(file_hash: Optional[str], file_title: str, config: Dict[
return 1
def _handle_local_file(file_path: Optional[str], file_title: str, args: Sequence[str], file_hash: Optional[str] = None) -> int:
def _handle_local_file(file_path: Optional[str], file_title: str, config: Dict[str, Any], args: Sequence[str], file_hash: Optional[str] = None) -> int:
"""Handle file from local storage - auto-play in MPV if media, otherwise open with default app."""
if not file_path:
log("Error: No file path provided", file=sys.stderr)

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",