This commit is contained in:
nose
2025-12-11 23:21:45 -08:00
parent 16d8a763cd
commit e2ffcab030
44 changed files with 3558 additions and 1793 deletions

View File

@@ -30,12 +30,12 @@ PIPELINE_PRESETS: List[PipelinePreset] = [
PipelinePreset(
label="Download → Merge → Local",
description="Use download-data with playlist auto-selection, merge the pieces, tag, then import into local storage.",
pipeline='download-data "<url>" | merge-file | add-tag | add-file -storage local',
pipeline='download-data "<url>" | merge-file | add-tags -store local | add-file -storage local',
),
PipelinePreset(
label="Download → Hydrus",
description="Fetch media, auto-tag, and push directly into Hydrus.",
pipeline='download-data "<url>" | merge-file | add-tag | add-file -storage hydrus',
pipeline='download-data "<url>" | merge-file | add-tags -store hydrus | add-file -storage hydrus',
),
PipelinePreset(
label="Search Local Library",

View File

@@ -781,9 +781,9 @@ class DownloadModal(ModalScreen):
# Stage 3: Add tags (now after merge, if merge happened)
# If merge succeeded, result_obj now points to merged file
if tags and (download_succeeded or not download_enabled):
add_tags_cmdlet = get_cmdlet("add-tag")
add_tags_cmdlet = get_cmdlet("add-tags")
if add_tags_cmdlet:
logger.info(f"Executing add-tag stage with {len(tags)} tags")
logger.info(f"Executing add-tags stage with {len(tags)} tags")
logger.info(f" Tags: {tags}")
logger.info(f" Source: {source}")
logger.info(f" Result path: {result_obj.path}")
@@ -791,10 +791,10 @@ class DownloadModal(ModalScreen):
# Log step to worker
if worker:
worker.log_step(f"Starting add-tag stage with {len(tags)} tags...")
worker.log_step(f"Starting add-tags stage with {len(tags)} tags...")
# Build add-tag arguments: tag1 tag2 tag3 --source <source>
tag_args = [str(t) for t in tags] + ["--source", str(source)]
# Build add-tags arguments. add-tags requires a store; for downloads, default to local sidecar tagging.
tag_args = ["-store", "local"] + [str(t) for t in tags] + ["--source", str(source)]
logger.info(f" Tag args: {tag_args}")
logger.info(f" Result object attributes: target={getattr(result_obj, 'target', 'MISSING')}, path={getattr(result_obj, 'path', 'MISSING')}, hash_hex={getattr(result_obj, 'hash_hex', 'MISSING')}")
@@ -814,12 +814,12 @@ class DownloadModal(ModalScreen):
# Log the tag output so it gets captured by WorkerLoggingHandler
if stdout_text:
logger.info(f"[add-tag output]\n{stdout_text}")
logger.info(f"[add-tags output]\n{stdout_text}")
if stderr_text:
logger.info(f"[add-tag stderr]\n{stderr_text}")
logger.info(f"[add-tags stderr]\n{stderr_text}")
if returncode != 0:
logger.error(f"add-tag stage failed with code {returncode}")
logger.error(f"add-tags stage failed with code {returncode}")
logger.error(f" stdout: {stdout_text}")
logger.error(f" stderr: {stderr_text}")
self.app.call_from_thread(
@@ -833,16 +833,16 @@ class DownloadModal(ModalScreen):
return
else:
if stdout_text:
logger.debug(f"add-tag stdout: {stdout_text}")
logger.debug(f"add-tags stdout: {stdout_text}")
if stderr_text:
logger.debug(f"add-tag stderr: {stderr_text}")
logger.info("add-tag stage completed successfully")
logger.debug(f"add-tags stderr: {stderr_text}")
logger.info("add-tags stage completed successfully")
# Log step to worker
if worker:
worker.log_step(f"Successfully added {len(tags)} tags")
except Exception as e:
logger.error(f"add-tag execution error: {e}", exc_info=True)
logger.error(f"add-tags execution error: {e}", exc_info=True)
self.app.call_from_thread(
self.app.notify,
f"Error adding tags: {e}",
@@ -852,10 +852,10 @@ class DownloadModal(ModalScreen):
self.app.call_from_thread(self._hide_progress)
return
else:
logger.error("add-tag cmdlet not found")
logger.error("add-tags cmdlet not found")
else:
if tags and download_enabled and not download_succeeded:
skip_msg = "⚠️ Skipping add-tag stage because download failed"
skip_msg = "⚠️ Skipping add-tags stage because download failed"
logger.info(skip_msg)
if worker:
worker.append_stdout(f"\n{skip_msg}\n")
@@ -1249,8 +1249,9 @@ class DownloadModal(ModalScreen):
stdout_buf = io.StringIO()
stderr_buf = io.StringIO()
tag_args = ["-store", "local"] + [str(t) for t in tags]
with redirect_stdout(stdout_buf), redirect_stderr(stderr_buf):
tag_returncode = tag_cmdlet(result_obj, tags, self.config)
tag_returncode = tag_cmdlet(result_obj, tag_args, self.config)
if tag_returncode != 0:
logger.warning(f"Tag stage returned code {tag_returncode}")

View File

@@ -171,14 +171,14 @@ class ExportModal(ModalScreen):
with Container(id="export-container"):
yield Static("Export File with Metadata", id="export-title")
# Row 1: Three columns (Tags, Metadata, Export-To Options)
# Row 1: Three columns (Tag, Metadata, Export-To Options)
self.tags_textarea = TextArea(
text=self._format_tags(),
id="tags-area",
read_only=False,
)
yield self.tags_textarea
self.tags_textarea.border_title = "Tags"
self.tags_textarea.border_title = "Tag"
# Metadata display instead of files tree
self.metadata_display = Static(

View File

@@ -83,7 +83,7 @@ class PipelineHubApp(App):
with Container(id="app-shell"):
with Horizontal(id="command-pane"):
self.command_input = Input(
placeholder='download-data "<url>" | merge-file | add-tag | add-file -storage local',
placeholder='download-data "<url>" | merge-file | add-tags -store local | add-file -storage local',
id="pipeline-input",
)
yield self.command_input