lkjlkj
This commit is contained in:
26
models.py
26
models.py
@@ -14,7 +14,7 @@ from typing import Any, Callable, Dict, List, Optional, Protocol, TextIO, Tuple
|
||||
|
||||
@dataclass(slots=True)
|
||||
class PipeObject:
|
||||
"""Unified pipeline object for tracking files, metadata, tags, and relationships through the pipeline.
|
||||
"""Unified pipeline object for tracking files, metadata, tag values, and relationships through the pipeline.
|
||||
|
||||
This is the single source of truth for all result data in the pipeline. Uses the hash+store
|
||||
canonical pattern for file identification.
|
||||
@@ -22,7 +22,7 @@ class PipeObject:
|
||||
Attributes:
|
||||
hash: SHA-256 hash of the file (canonical identifier)
|
||||
store: Storage backend name (e.g., 'default', 'hydrus', 'test', 'home')
|
||||
tags: List of extracted or assigned tags
|
||||
tag: List of extracted or assigned tag values
|
||||
title: Human-readable title if applicable
|
||||
source_url: URL where the object came from
|
||||
duration: Duration in seconds if applicable
|
||||
@@ -37,7 +37,7 @@ class PipeObject:
|
||||
"""
|
||||
hash: str
|
||||
store: str
|
||||
tags: List[str] = field(default_factory=list)
|
||||
tag: List[str] = field(default_factory=list)
|
||||
title: Optional[str] = None
|
||||
url: Optional[str] = None
|
||||
source_url: Optional[str] = None
|
||||
@@ -90,9 +90,9 @@ class PipeObject:
|
||||
hash_display = self.hash or "N/A"
|
||||
store_display = self.store or "N/A"
|
||||
title_display = self.title or "N/A"
|
||||
tags_display = ", ".join(self.tags[:3]) if self.tags else "[]"
|
||||
if len(self.tags) > 3:
|
||||
tags_display += f" (+{len(self.tags) - 3} more)"
|
||||
tag_display = ", ".join(self.tag[:3]) if self.tag else "[]"
|
||||
if len(self.tag) > 3:
|
||||
tag_display += f" (+{len(self.tag) - 3} more)"
|
||||
file_path_display = self.path or "N/A"
|
||||
if file_path_display != "N/A" and len(file_path_display) > 50:
|
||||
file_path_display = "..." + file_path_display[-47:]
|
||||
@@ -120,7 +120,7 @@ class PipeObject:
|
||||
debug(f"│ Hash : {hash_display:<48}│")
|
||||
debug(f"│ Store : {store_display:<48}│")
|
||||
debug(f"│ Title : {title_display:<48}│")
|
||||
debug(f"│ Tags : {tags_display:<48}│")
|
||||
debug(f"│ Tag : {tag_display:<48}│")
|
||||
debug(f"│ URL : {url_display:<48}│")
|
||||
debug(f"│ File Path : {file_path_display:<48}│")
|
||||
debug(f"│ Relationships: {relationships_display:<47}│")
|
||||
@@ -164,8 +164,8 @@ class PipeObject:
|
||||
"store": self.store,
|
||||
}
|
||||
|
||||
if self.tags:
|
||||
data["tags"] = self.tags
|
||||
if self.tag:
|
||||
data["tag"] = self.tag
|
||||
if self.title:
|
||||
data["title"] = self.title
|
||||
if self.url:
|
||||
@@ -298,7 +298,7 @@ class DownloadMediaResult:
|
||||
"""Result of a successful media download."""
|
||||
path: Path
|
||||
info: Dict[str, Any]
|
||||
tags: List[str]
|
||||
tag: List[str]
|
||||
source_url: Optional[str]
|
||||
hash_value: Optional[str] = None
|
||||
paths: Optional[List[Path]] = None # For multiple files (e.g., section downloads)
|
||||
@@ -677,7 +677,7 @@ class TUIResultCard:
|
||||
subtitle: Optional[str] = None
|
||||
metadata: Optional[Dict[str, str]] = None
|
||||
media_kind: Optional[str] = None
|
||||
tags: Optional[List[str]] = None
|
||||
tag: Optional[List[str]] = None
|
||||
file_hash: Optional[str] = None
|
||||
file_size: Optional[str] = None
|
||||
duration: Optional[str] = None
|
||||
@@ -686,8 +686,8 @@ class TUIResultCard:
|
||||
"""Initialize default values."""
|
||||
if self.metadata is None:
|
||||
self.metadata = {}
|
||||
if self.tags is None:
|
||||
self.tags = []
|
||||
if self.tag is None:
|
||||
self.tag = []
|
||||
|
||||
|
||||
@dataclass
|
||||
|
||||
Reference in New Issue
Block a user