ssd
This commit is contained in:
@@ -783,56 +783,56 @@ class ResultTable:
|
||||
|
||||
def _add_search_result(self, row: ResultRow, result: Any) -> None:
|
||||
"""Extract and add SearchResult fields to row."""
|
||||
# If provider supplied explicit columns, render those and skip legacy defaults
|
||||
cols = getattr(result, "columns", None)
|
||||
used_explicit_columns = False
|
||||
if cols:
|
||||
used_explicit_columns = True
|
||||
for name, value in cols:
|
||||
row.add_column(name, value)
|
||||
return
|
||||
else:
|
||||
# Core fields (legacy fallback)
|
||||
title = getattr(result, "title", "")
|
||||
table = str(getattr(result, "table", "") or "").lower()
|
||||
|
||||
# Core fields (legacy fallback)
|
||||
title = getattr(result, "title", "")
|
||||
table = str(getattr(result, "table", "") or "").lower()
|
||||
# Handle extension separation for local files
|
||||
extension = ""
|
||||
if title and table == "local":
|
||||
path_obj = Path(title)
|
||||
if path_obj.suffix:
|
||||
extension = path_obj.suffix.lstrip(".")
|
||||
title = path_obj.stem
|
||||
|
||||
# Handle extension separation for local files
|
||||
extension = ""
|
||||
if title and table == "local":
|
||||
path_obj = Path(title)
|
||||
if path_obj.suffix:
|
||||
extension = path_obj.suffix.lstrip(".")
|
||||
title = path_obj.stem
|
||||
if title:
|
||||
row.add_column("Title", title)
|
||||
|
||||
if title:
|
||||
row.add_column("Title", title)
|
||||
# Extension column
|
||||
row.add_column("Ext", extension)
|
||||
|
||||
# Extension column
|
||||
row.add_column("Ext", extension)
|
||||
if hasattr(result, "table") and getattr(result, "table", None):
|
||||
row.add_column("Source", str(getattr(result, "table")))
|
||||
|
||||
if hasattr(result, "table") and getattr(result, "table", None):
|
||||
row.add_column("Source", str(getattr(result, "table")))
|
||||
if hasattr(result, "detail") and result.detail:
|
||||
row.add_column("Detail", result.detail)
|
||||
|
||||
if hasattr(result, "detail") and result.detail:
|
||||
row.add_column("Detail", result.detail)
|
||||
if hasattr(result, "media_kind") and result.media_kind:
|
||||
row.add_column("Type", result.media_kind)
|
||||
|
||||
if hasattr(result, "media_kind") and result.media_kind:
|
||||
row.add_column("Type", result.media_kind)
|
||||
# Tag summary
|
||||
if hasattr(result, "tag_summary") and result.tag_summary:
|
||||
row.add_column("Tag", str(result.tag_summary))
|
||||
|
||||
# Tag summary
|
||||
if hasattr(result, "tag_summary") and result.tag_summary:
|
||||
row.add_column("Tag", str(result.tag_summary))
|
||||
# Duration (for media)
|
||||
if hasattr(result, "duration_seconds") and result.duration_seconds:
|
||||
dur = _format_duration_hms(result.duration_seconds)
|
||||
row.add_column("Duration", dur or str(result.duration_seconds))
|
||||
|
||||
# Duration (for media)
|
||||
if hasattr(result, "duration_seconds") and result.duration_seconds:
|
||||
dur = _format_duration_hms(result.duration_seconds)
|
||||
row.add_column("Duration", dur or str(result.duration_seconds))
|
||||
# Size (for files)
|
||||
if hasattr(result, "size_bytes") and result.size_bytes:
|
||||
row.add_column("Size", _format_size(result.size_bytes, integer_only=False))
|
||||
|
||||
# Size (for files)
|
||||
if hasattr(result, "size_bytes") and result.size_bytes:
|
||||
row.add_column("Size", _format_size(result.size_bytes, integer_only=False))
|
||||
|
||||
# Annotations
|
||||
if hasattr(result, "annotations") and result.annotations:
|
||||
row.add_column("Annotations", ", ".join(str(a) for a in result.annotations))
|
||||
# Annotations
|
||||
if hasattr(result, "annotations") and result.annotations:
|
||||
row.add_column("Annotations", ", ".join(str(a) for a in result.annotations))
|
||||
|
||||
try:
|
||||
md = getattr(result, "full_metadata", None)
|
||||
|
||||
Reference in New Issue
Block a user