continuing refactor

This commit is contained in:
2026-05-03 21:20:05 -07:00
parent 77cab1bd27
commit 5534812426
50 changed files with 1004 additions and 428 deletions
+7 -7
View File
@@ -28,16 +28,16 @@ class Get_Metadata(Cmdlet):
super().__init__(
name="get-metadata",
summary="Print metadata for files by hash and storage backend.",
usage='get-metadata [-query "hash:<sha256>"] [-store <backend>]',
usage='get-metadata [-query "hash:<sha256>"] [-instance <backend>]',
alias=["meta"],
arg=[
SharedArgs.QUERY,
SharedArgs.STORE,
SharedArgs.INSTANCE,
],
detail=[
"- Retrieves metadata from storage backend using file hash as identifier.",
"- Shows hash, MIME type, size, duration/pages, known url, and import timestamp.",
"- Hash and store are taken from piped result or can be overridden with -query/-store flags.",
"- Hash and store are taken from piped result or can be overridden with -query/-instance flags.",
"- All metadata is retrieved from the storage backend's database (single source of truth).",
],
exec=self.run,
@@ -124,7 +124,7 @@ class Get_Metadata(Cmdlet):
Args:
title: File or resource title
store: Backend store name (e.g., "hydrus", "local")
instance: Backend store name (e.g., "hydrus", "local")
path: File path or resource identifier
mime: MIME type (e.g., "image/jpeg", "video/mp4")
size_bytes: File size in bytes
@@ -249,7 +249,7 @@ class Get_Metadata(Cmdlet):
Args:
result: Piped input (dict with optional hash/store/title/tag fields)
args: Command line arguments ([-query "hash:..."] [-store backend])
args: Command line arguments ([-query "hash:..."] [-instance backend])
config: Application configuration dict
Returns:
@@ -268,14 +268,14 @@ class Get_Metadata(Cmdlet):
# Get hash and store from parsed args or result
file_hash = query_hash or get_field(result, "hash")
storage_source = parsed.get("store") or get_field(result, "store")
storage_source = parsed.get("instance") or get_field(result, "store")
if not file_hash:
log('No hash available - use -query "hash:<sha256>"', file=sys.stderr)
return 1
if not storage_source:
log("No storage backend specified - use -store to specify", file=sys.stderr)
log("No storage backend specified - use -instance to specify", file=sys.stderr)
return 1
# Use storage backend to get metadata