@danhachuel/thunderbolt 0.5.72 → 0.5.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1243,6 +1243,22 @@ def _valid_artifact_path(value: Any) -> Path | None:
1243
1243
  return None
1244
1244
 
1245
1245
 
1246
+ def _existing_thumbnail_path(task: dict[str, Any], artifacts: dict[str, Any], variant: dict[str, Any]) -> Path | None:
1247
+ """Find a thumbnail made previously by Pipeline Vídeos or the UI."""
1248
+ candidates: list[Any] = [
1249
+ artifacts.get("thumbnail"),
1250
+ task.get("thumbnail_path"),
1251
+ variant.get("image_path"),
1252
+ ]
1253
+ variants = task.get("thumbnail_variants") if isinstance(task.get("thumbnail_variants"), list) else []
1254
+ candidates.extend(item.get("image_path") for item in variants if isinstance(item, dict))
1255
+ for value in candidates:
1256
+ path = _valid_artifact_path(value)
1257
+ if path is not None:
1258
+ return path
1259
+ return None
1260
+
1261
+
1246
1262
  def _read_json_artifact(value: Any) -> dict[str, Any] | None:
1247
1263
  path = _valid_artifact_path(value)
1248
1264
  if path is None:
@@ -1482,7 +1498,8 @@ def _run_task(task: dict[str, Any]) -> dict[str, Any]:
1482
1498
 
1483
1499
  _update(task_id, stage="thumbnail", state="doing", progress=max(86, int(task.get("progress") or 0)), error=None)
1484
1500
  current_artifacts = dict((_task_by_id(task_id) or {}).get("artifacts") or artifacts)
1485
- existing_thumbnail = _valid_artifact_path(current_artifacts.get("thumbnail") or variant.get("image_path"))
1501
+ current_task = _task_by_id(task_id) or task
1502
+ existing_thumbnail = _existing_thumbnail_path(current_task, current_artifacts, variant)
1486
1503
  if existing_thumbnail is not None:
1487
1504
  thumbnail_path = existing_thumbnail
1488
1505
  else:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.72",
3
+ "version": "0.5.73",
4
4
  "description": "Thunderbolt — interface local para operação de canais faceless e motor MoneyPrinterTurbo",
5
5
  "license": "MIT",
6
6
  "main": "scripts/cli.mjs",