@danhachuel/thunderbolt 0.7.22 → 0.7.24
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 +9 -2
- package/package.json +1 -1
package/app/main.py
CHANGED
|
@@ -5169,6 +5169,13 @@ def _saved_script_task_matches(task: dict[str, Any], record: dict[str, Any], cha
|
|
|
5169
5169
|
def _sync_saved_scripts_to_youtube_automation() -> None:
|
|
5170
5170
|
"""Expose every saved video script as one manual YouTube task, without duplicates."""
|
|
5171
5171
|
records = _backfill_saved_script_blueprints(list_script_documents())
|
|
5172
|
+
sync_signature = "|".join(
|
|
5173
|
+
f"{record.get('id', '')}:{record.get('created_at', '')}:{record.get('blueprint_id', '')}:{record.get('blueprint_name', '')}"
|
|
5174
|
+
for record in records
|
|
5175
|
+
if str(record.get("document_type") or "video_script").strip() == "video_script"
|
|
5176
|
+
)
|
|
5177
|
+
if st.session_state.get("youtube_script_sync_signature") == sync_signature:
|
|
5178
|
+
return
|
|
5172
5179
|
channels = [item for item in read_json("channels.json", []) if isinstance(item, dict)]
|
|
5173
5180
|
existing_tasks = load_video_tasks_for_catalog()
|
|
5174
5181
|
for raw_record in records:
|
|
@@ -5201,6 +5208,7 @@ def _sync_saved_scripts_to_youtube_automation() -> None:
|
|
|
5201
5208
|
continue
|
|
5202
5209
|
created = _create_video_task_from_saved_script(record, channel, {})
|
|
5203
5210
|
existing_tasks.extend(created)
|
|
5211
|
+
st.session_state["youtube_script_sync_signature"] = sync_signature
|
|
5204
5212
|
|
|
5205
5213
|
|
|
5206
5214
|
def _automation_created_at(task: dict[str, Any]) -> tuple[datetime, str]:
|
|
@@ -5217,8 +5225,6 @@ def _automation_created_at(task: dict[str, Any]) -> tuple[datetime, str]:
|
|
|
5217
5225
|
def load_automation_tasks_for_platform(platform_name: str) -> list[dict[str, Any]]:
|
|
5218
5226
|
"""Return only automation/catalog tasks belonging to one publishing platform."""
|
|
5219
5227
|
target = str(platform_name or "").strip().casefold()
|
|
5220
|
-
if target == "youtube":
|
|
5221
|
-
_sync_saved_scripts_to_youtube_automation()
|
|
5222
5228
|
return sorted(
|
|
5223
5229
|
[task for task in load_video_tasks_for_catalog() if task_platform(task) == target],
|
|
5224
5230
|
key=_automation_created_at,
|
|
@@ -6141,6 +6147,7 @@ def _render_youtube_automation_cards():
|
|
|
6141
6147
|
def render_automation():
|
|
6142
6148
|
st.title("Automação Youtube")
|
|
6143
6149
|
st.caption("Agendamento diário da geração por canal. O worker verifica o relógio local do computador e coloca os lotes agendados na fila.")
|
|
6150
|
+
_sync_saved_scripts_to_youtube_automation()
|
|
6144
6151
|
worker_status = load_worker_status()
|
|
6145
6152
|
local_now = datetime.now().astimezone()
|
|
6146
6153
|
if worker_status.get("alive"):
|
package/package.json
CHANGED