@danhachuel/thunderbolt 0.5.63 → 0.5.65

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
@@ -1332,9 +1332,9 @@ def render_channel_edit_form(channel: dict, youtube_account_ids: list[str], yout
1332
1332
  edited_style = st.selectbox("Fonte do vídeo", WIDE_STYLE_OPTIONS, index=WIDE_STYLE_OPTIONS.index(channel_video_source_value(channel.get("style_wide"))) if channel_video_source_value(channel.get("style_wide")) in WIDE_STYLE_OPTIONS else 0)
1333
1333
  edited_aspect = st.selectbox("Proporção do vídeo", CHANNEL_ASPECT_RATIO_OPTIONS, index=CHANNEL_ASPECT_RATIO_OPTIONS.index(str(channel.get("video_aspect_ratio") or "Landscape 16:9")) if str(channel.get("video_aspect_ratio") or "Landscape 16:9") in CHANNEL_ASPECT_RATIO_OPTIONS else 0)
1334
1334
  edited_niche = st.text_input("Nicho", value=str(channel.get("niche") or channel_niche_label(channel) if channel_niche_label(channel) != "SEM NICHO CONFIGURADO" else "") )
1335
- edited_subscribers = st.number_input("Inscritos", min_value=0, value=int(str(channel.get("subscriber_count") or 0).replace(".", "").replace(",", "")), step=1)
1336
- edited_videos = st.number_input("Vídeos", min_value=0, value=int(str(channel.get("video_count") or 0).replace(".", "").replace(",", "")), step=1)
1337
- edited_views = st.number_input("Visualizações", min_value=0, value=int(str(channel.get("view_count") or 0).replace(".", "").replace(",", "")), step=1)
1335
+ edited_subscribers = st.text_input("Inscritos", value=_channel_count_text(channel.get("subscriber_count")))
1336
+ edited_videos = st.text_input("Vídeos", value=_channel_count_text(channel.get("video_count")))
1337
+ edited_views = st.text_input("Visualizações", value=_channel_count_text(channel.get("view_count")))
1338
1338
  with edit_cols[1]:
1339
1339
  edited_blueprint = st.selectbox("Blueprint Padrão", blueprint_ids, index=blueprint_ids.index(current_blueprint) if current_blueprint in blueprint_ids else 0, format_func=lambda item: blueprint_labels.get(item, item or "Sem Blueprint padrão"))
1340
1340
  edited_voice = st.selectbox("Narrador/Voz Padrão", voice_options, index=voice_options.index(current_voice) if current_voice in voice_options else 0, format_func=lambda item: item or "Sem voz padrão")
@@ -1361,7 +1361,7 @@ def render_channel_edit_form(channel: dict, youtube_account_ids: list[str], yout
1361
1361
  "default_voice": edited_voice.strip(), "voice": edited_voice.strip(),
1362
1362
  "google_account_id": edited_account.strip(), "google_account_email": str(youtube_accounts_by_id.get(edited_account, {}).get("email", "")),
1363
1363
  "description": edited_description.strip(), "automation_on": bool(edited_automation), "automation_time": edited_time.strip(),
1364
- "subscriber_count": int(edited_subscribers) or None, "video_count": int(edited_videos) or None, "view_count": int(edited_views) or None,
1364
+ "subscriber_count": _channel_count_value(edited_subscribers) or None, "video_count": _channel_count_value(edited_videos) or None, "view_count": _channel_count_value(edited_views) or None,
1365
1365
  })
1366
1366
  st.session_state.pop(f"edit_channel_{channel_id}", None)
1367
1367
  st.success("Canal actualizado.")
@@ -2347,12 +2347,29 @@ def is_youtube_channel_record(channel: Any) -> bool:
2347
2347
  return classify_channel_platform(channel) == "youtube"
2348
2348
 
2349
2349
 
2350
+ def _channel_count_value(value: Any) -> int:
2351
+ if value in (None, ""):
2352
+ return 0
2353
+ text = str(value).strip().replace(" ", "")
2354
+ if "." in text or "," in text:
2355
+ return int(re.sub(r"[^0-9]", "", text) or 0)
2356
+ try:
2357
+ return max(0, int(value))
2358
+ except (TypeError, ValueError):
2359
+ return 0
2360
+
2361
+
2362
+ def _channel_count_text(value: Any) -> str:
2363
+ parsed = _channel_count_value(value)
2364
+ return f"{parsed:,}".replace(",", ".") if parsed else ""
2365
+
2366
+
2350
2367
  def _format_channel_count(value: Any) -> str:
2351
2368
  """Mostrar contadores inteiros com ponto a cada três algarismos."""
2352
2369
  if value is None or str(value).strip() == "":
2353
2370
  return "—"
2354
2371
  try:
2355
- return f"{int(value):,}".replace(",", ".")
2372
+ return f"{_channel_count_value(value):,}".replace(",", ".")
2356
2373
  except (TypeError, ValueError):
2357
2374
  return str(value)
2358
2375
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@danhachuel/thunderbolt",
3
- "version": "0.5.63",
3
+ "version": "0.5.65",
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",
@@ -440,8 +440,9 @@ function installRequirementIfNeeded(requirementsPath, stateKey, modules, label)
440
440
  const markerPath = join(venvPath, `.${stateKey}.sha256`);
441
441
  const markerHash = existsSync(markerPath) ? readFileSync(markerPath, "utf8").trim() : "";
442
442
  const persistedHashMatches = hashMatches || markerHash === currentHash;
443
- if (!forceDeps && importsOk && persistedHashMatches) {
443
+ if (!forceDeps && importsOk) {
444
444
  console.log(`${label}: dependências detectadas e reutilizadas; nenhuma reinstalação necessária.`);
445
+ writeFileSync(markerPath, `${currentHash}\n`, "utf8");
445
446
  writeDependencyState({ [stateKey]: currentHash });
446
447
  return;
447
448
  }
@@ -469,7 +470,7 @@ function writeSettings(moneyprinterPath) {
469
470
 
470
471
  function installThunderboltDependencies(python) {
471
472
  if (!existsSync(pythonBin)) run(python.command, [...python.args, "-m", "venv", venvPath]);
472
- installRequirementIfNeeded(join(root, "requirements.txt"), "thunderbolt_requirements_sha256", ["streamlit", "requests", "pandas", "toml", "imageio_ffmpeg", "edge_tts", "google.auth", "google_auth_oauthlib", "googleapiclient", "yt_dlp", "youtube_transcript_api"], "Thunderbolt");
473
+ installRequirementIfNeeded(join(root, "requirements.txt"), "thunderbolt_requirements_sha256", ["streamlit", "requests", "pandas", "toml", "imageio_ffmpeg", "edge_tts", "google.auth", "google_auth_oauthlib", "googleapiclient", "yt_dlp", "youtube_transcript_api", "huggingface_hub"], "Thunderbolt");
473
474
  }
474
475
 
475
476
  function installMoneyPrinterDependencies(moneyprinterPath) {