[object Object]

← back to Allnewsdaily

allnewsdaily /videos: Mac2 sync-and-push job for data/videos.json (auto-update, mirrors wire-push)

bf3c145bbda25861a80f617d57674b3bf4fc198d · 2026-09-10 00:04:05 -0700 · Steve Abrams

Files touched

Diff

commit bf3c145bbda25861a80f617d57674b3bf4fc198d
Author: Steve Abrams <steve@designerwallcoverings.com>
Date:   Thu Sep 10 00:04:05 2026 -0700

    allnewsdaily /videos: Mac2 sync-and-push job for data/videos.json (auto-update, mirrors wire-push)
---
 com.steve.allnewsdaily-videos-push.plist | 38 ++++++++++++++++++++++++++++++++
 scripts/push-videos.sh                   | 22 ++++++++++++++++++
 2 files changed, 60 insertions(+)

diff --git a/com.steve.allnewsdaily-videos-push.plist b/com.steve.allnewsdaily-videos-push.plist
new file mode 100644
index 0000000..f076989
--- /dev/null
+++ b/com.steve.allnewsdaily-videos-push.plist
@@ -0,0 +1,38 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<!-- Mac2 job: sync the All News Daily channel + push data/videos.json to Kamatera so
+     allnewsdaily.com/videos auto-updates. Runs ~30min after each Short publishes, + on load.
+     NOT loaded automatically — remote push to prod is Steve-gated.
+     Load:   launchctl bootstrap gui/$(id -u) ~/Library/LaunchAgents/com.steve.allnewsdaily-videos-push.plist
+     Unload: launchctl bootout   gui/$(id -u) ~/Library/LaunchAgents/com.steve.allnewsdaily-videos-push.plist -->
+<plist version="1.0">
+<dict>
+  <key>Label</key>
+  <string>com.steve.allnewsdaily-videos-push</string>
+  <key>ProgramArguments</key>
+  <array>
+    <string>/bin/bash</string>
+    <string>/Users/macstudio3/Projects/allnewsdaily/scripts/push-videos.sh</string>
+  </array>
+  <key>EnvironmentVariables</key>
+  <dict>
+    <key>PATH</key>
+    <string>/opt/homebrew/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin</string>
+    <key>HOME</key>
+    <string>/Users/macstudio3</string>
+  </dict>
+  <key>RunAtLoad</key>
+  <true/>
+  <key>StartCalendarInterval</key>
+  <array>
+    <dict><key>Hour</key><integer>6</integer><key>Minute</key><integer>30</integer></dict>
+    <dict><key>Hour</key><integer>11</integer><key>Minute</key><integer>30</integer></dict>
+    <dict><key>Hour</key><integer>16</integer><key>Minute</key><integer>30</integer></dict>
+    <dict><key>Hour</key><integer>21</integer><key>Minute</key><integer>30</integer></dict>
+  </array>
+  <key>StandardOutPath</key>
+  <string>/Users/macstudio3/Projects/allnewsdaily/data/videos-push.log</string>
+  <key>StandardErrorPath</key>
+  <string>/Users/macstudio3/Projects/allnewsdaily/data/videos-push.log</string>
+</dict>
+</plist>
diff --git a/scripts/push-videos.sh b/scripts/push-videos.sh
new file mode 100755
index 0000000..b2c5931
--- /dev/null
+++ b/scripts/push-videos.sh
@@ -0,0 +1,22 @@
+#!/usr/bin/env bash
+# Sync the All News Daily channel's Shorts on THIS Mac (token lives here) then rsync data/videos.json
+# to Kamatera prod so allnewsdaily.com/videos auto-updates. Mirrors push-wire.sh / push-live-status.sh.
+# Reversible: unload the launchd job to stop.
+set -euo pipefail
+cd "$(dirname "$0")/.."   # allnewsdaily repo root
+PROD="${PROD_HOST:-root@45.61.58.125}"
+REMOTE="/root/Projects/allnewsdaily/data/videos.json"
+
+NODE="$(command -v node || true)"
+for cand in /opt/homebrew/bin/node /usr/local/bin/node /usr/bin/node; do
+  [ -z "$NODE" ] && [ -x "$cand" ] && NODE="$cand"
+done
+[ -n "$NODE" ] || { echo "[videos-push] node not found"; exit 3; }
+
+"$NODE" scripts/sync-videos.mjs || { echo "[videos-push] sync failed, not pushing"; exit 1; }
+"$NODE" -e "const a=require('./data/videos.json'); if(!Array.isArray(a)){process.exit(2)}" \
+  || { echo "[videos-push] videos.json invalid, not pushing"; exit 2; }
+
+rsync -az -e "ssh -o ConnectTimeout=10 -o StrictHostKeyChecking=accept-new" \
+  data/videos.json "$PROD:$REMOTE"
+echo "[videos-push] pushed $(date -u +%FT%TZ) → $PROD:$REMOTE"

← 3585c9c allnewsdaily: add /videos page embedding channel Shorts + sy  ·  back to Allnewsdaily  ·  sync package-lock.json with package.json (https-proxy-agent 75e04a0 →