huge refactor of plugin system

This commit is contained in:
2026-04-30 18:56:22 -07:00
parent ea3ead248b
commit be5a11da97
99 changed files with 7603 additions and 11320 deletions
+46 -7
View File
@@ -30,6 +30,7 @@ class SearchResult:
def to_dict(self) -> Dict[str, Any]:
"""Convert to dictionary for pipeline processing."""
full_metadata = self.full_metadata if isinstance(self.full_metadata, dict) else {}
out = {
"table": self.table,
"title": self.title,
@@ -40,15 +41,29 @@ class SearchResult:
"size_bytes": self.size_bytes,
"tag": list(self.tag),
"columns": list(self.columns),
"full_metadata": self.full_metadata,
"full_metadata": full_metadata,
}
try:
url_value = getattr(self, "url", None)
if url_value is not None:
out["url"] = url_value
except Exception:
pass
for key in (
"url",
"hash",
"hash_hex",
"store",
"name",
"mime",
"file_id",
"ext",
"size",
):
value = None
try:
value = getattr(self, key, None)
except Exception:
value = None
if value is None and key in full_metadata:
value = full_metadata.get(key)
if value is not None:
out[key] = value
try:
selection_args = getattr(self, "selection_args", None)
@@ -195,6 +210,30 @@ class Provider(ABC):
"""
return "search-file", list(args_list)
def resolve_pipe_item_context(
self,
item: Any,
*,
metadata: Optional[Dict[str, Any]] = None,
store: Optional[str] = None,
file_hash: Optional[str] = None,
targets: Optional[Sequence[str]] = None,
) -> Optional[Tuple[Optional[str], Optional[str]]]:
"""Optionally normalize store/hash context for pipe playback helpers."""
_ = item, metadata, store, file_hash, targets
return None
def infer_playlist_store(
self,
item: Any,
*,
target: str,
file_storage: Any = None,
) -> Optional[str]:
"""Optionally infer a friendly store label for an MPV playlist entry."""
_ = item, target, file_storage
return None
@property
def prefers_transfer_progress(self) -> bool:
"""True if this plugin prefers explicit transfer progress tracking (begin/finish) during download."""