@danhachuel/thunderbolt 0.7.27 → 0.7.29

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.
package/app/main.py CHANGED
@@ -5651,7 +5651,27 @@ def render_thumbnails():
5651
5651
  return
5652
5652
 
5653
5653
  settings = read_json("settings.json", {})
5654
- for record in records:
5654
+ page_size = 24
5655
+ page_count = max(1, (len(records) + page_size - 1) // page_size)
5656
+ current_page = st.session_state.get("thumbnail_gallery_page", 1)
5657
+ try:
5658
+ current_page = min(max(int(current_page), 1), page_count)
5659
+ except (TypeError, ValueError):
5660
+ current_page = 1
5661
+ if page_count > 1:
5662
+ current_page = st.selectbox(
5663
+ "Página de thumbnails",
5664
+ options=list(range(1, page_count + 1)),
5665
+ index=current_page - 1,
5666
+ format_func=lambda value: f"Página {value} de {page_count}",
5667
+ key="thumbnail_gallery_page",
5668
+ )
5669
+ start = (current_page - 1) * page_size
5670
+ visible_records = records[start : start + page_size]
5671
+ st.caption(f"A mostrar {start + 1}–{min(start + page_size, len(records))} de {len(records)} thumbnails.")
5672
+ else:
5673
+ visible_records = records
5674
+ for record in visible_records:
5655
5675
  task_id = record["task_id"]
5656
5676
  with st.container(border=True):
5657
5677
  image_col, details_col, action_col = st.columns([1.25, 2.35, 1.7])
@@ -492,6 +492,46 @@ def retry_task_with_current_settings(task_id: str) -> dict[str, Any] | None:
492
492
  return update_json("tasks.json", [], mutate)
493
493
 
494
494
 
495
+ def _refresh_task_channel_video_settings(task: dict[str, Any]) -> None:
496
+ """Apply the channel's current video defaults while preserving the saved script."""
497
+ channel_id = str(task.get("channel_id") or "").strip()
498
+ channels = read_json("channels.json", [])
499
+ channel = next(
500
+ (item for item in channels if isinstance(item, dict) and str(item.get("id") or "") == channel_id),
501
+ None,
502
+ ) if isinstance(channels, list) else None
503
+ if not channel:
504
+ return
505
+ generation_settings = dict(task.get("generation_settings") or {})
506
+ channel_defaults = {
507
+ "enable_subtitles": ("default_enable_subtitles", True),
508
+ "subtitle_font": ("default_subtitle_font", "MicrosoftYaHeiBold.ttc"),
509
+ "subtitle_position": ("default_subtitle_position", "Bottom (Recommended)"),
510
+ "subtitle_color": ("default_subtitle_color", "#FFFFFF"),
511
+ "subtitle_background": ("default_subtitle_background", True),
512
+ "subtitle_background_color": ("default_subtitle_background_color", "#000000"),
513
+ "subtitle_rounded_background": ("default_subtitle_rounded_background", False),
514
+ "subtitle_font_size": ("default_subtitle_font_size", 60),
515
+ "subtitle_outline": ("default_subtitle_outline", "#000000"),
516
+ "subtitle_outline_width": ("default_subtitle_outline_width", 1.5),
517
+ "background_music_source": ("default_background_music_source", "Sem música"),
518
+ "background_music_volume": ("default_background_music_volume", "20%"),
519
+ }
520
+ for setting_name, (channel_key, default) in channel_defaults.items():
521
+ generation_settings[setting_name] = channel.get(channel_key, default)
522
+ task["generation_settings"] = generation_settings
523
+ task["voice"] = channel.get("default_voice") or channel.get("voice") or task.get("voice", "")
524
+ task["thumbnail_blueprint_id"] = (
525
+ channel.get("default_thumbnail_blueprint_id")
526
+ or channel.get("thumbnail_blueprint_id")
527
+ or task.get("thumbnail_blueprint_id")
528
+ or GENERIC_THUMBNAIL_BLUEPRINT_ID
529
+ )
530
+ task["blueprint_id"] = channel.get("default_blueprint_id") or channel.get("blueprint_id") or task.get("blueprint_id", "")
531
+ if channel.get("style_wide"):
532
+ task["style_wide"] = channel["style_wide"]
533
+
534
+
495
535
  def remake_video_task(task_id: str) -> dict[str, Any] | None:
496
536
  """Queue a fresh video render while retaining the task's creative inputs.
497
537
 
@@ -510,6 +550,7 @@ def remake_video_task(task_id: str) -> dict[str, Any] | None:
510
550
  continue
511
551
  if str(task.get("state") or "") == "doing":
512
552
  raise ValueError("Pare a tarefa antes de refazer o vídeo.")
553
+ _refresh_task_channel_video_settings(task)
513
554
  artifacts = dict(task.get("artifacts") or {})
514
555
  artifacts.pop("video", None)
515
556
  artifacts.pop("upload", None)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.7.27",
3
+ "version": "0.7.29",
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",