Kapitel 13/Tutorial.md aktualisiert

This commit is contained in:
2025-08-28 20:04:00 +00:00
parent 6e5542d1b8
commit e7c4eb7340

View File

@@ -429,58 +429,33 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
8. Pfad 1 - CREATE_AND_DOWNLOAD 8. Pfad 1 - CREATE_AND_DOWNLOAD
Verkabelung (ein einzelnes VOD): Verkabelung (mehrere VODs einfach & klar):
- Switch-Output **CREATE_AND_DOWNLOAD** → **Merge (Combine → All Possible Combinations)** (Eingang 1) - **HTTP Request: VODs abrufen** → **Split Out** (Field to Split Out: `data`)
- **HTTP Request: VOD-Daten abrufen** → **Item Lists: Split Out Items (Input = data)** → **Merge (Combine → All Possible Combinations)** (Eingang 2) - **Split Out** → **Switch (Regeln aus Punkt 7)**
- **Merge (Combine → All Possible Combinations)** → **SSH: State-Datei anlegen** → **SSH: VOD herunterladen (yt-dlp)** - **Switch → Output CREATE_AND_DOWNLOAD** → **SSH: State-Datei anlegen** → **SSH: VOD herunterladen (yt-dlp)**
> [!NOTE] Split Out Einstellungen:
> Durch **Split Out Items** wird aus jedem Eintrag in `data[]` genau **ein Item**. Wenn Twitch nur ein aktuelles VOD liefert, ergibt sich 1×1 = 1 Item. > Wenn mehrere VODs geliefert werden, laufen die folgenden Nodes **pro VOD** einmal. - Node: **Split Out**
Item Lists Einstellungen (nach dem HTTP Request):
- Typ: Item Lists
- Operation: **Split Out Items** - Operation: **Split Out Items**
- Field to Split Out: **data** - **Field to Split Out:** `data`
SSH State-Datei anlegen (nur wenn State-Datei nicht existiert):
Merge Einstellungen: - Typ: SSH • Credentials: SSH Clipper • Operation: Execute Command • Command is an Expression: ON
- Typ: Merge
- Mode: **Combine**
- Combine Mode: **All Possible Combinations**
- Eingang 1: vom Switch-Branch (liefert 1 Item)
- Eingang 2: vom **Split Out Items** (liefert N Items)
- Ergebnis: **1×N** Kombination → ein Item **pro VOD**, VOD-Felder sind im JSON verfügbar (z.B. `id`, `title`, …).
Set (optional, empfehlenswert):
- `vodId` → `{{ $json.id ?? $json.data?.id ?? $json.data?.[0]?.id }}`
SSH State-Datei anlegen (nur wenn State-Datei **nicht existiert**):
- Typ: SSH
- Credentials: SSH Clipper
- Operation: Execute Command
- Command is an Expression: ON
Command (Expression): Command (Expression):
``` ```
{{`set -euo pipefail; mkdir -p /srv/clipper/state; printf "%s {{`set -euo pipefail; mkdir -p /srv/clipper/state; printf "%s
" "${$json.vodId ?? $json.id}" > /srv/clipper/state/vod_seen.list`}} " "${$json.vodId ?? $json.id ?? $json.data?.id ?? $json.data?.[0]?.id}" > /srv/clipper/state/vod_seen.list`}}
``` ```
SSH VOD herunterladen (yt-dlp): SSH VOD herunterladen (yt-dlp):
- Typ: SSH - Typ: SSH • Credentials: SSH Clipper • Operation: Execute Command • Command is an Expression: ON
- Credentials: SSH Clipper
- Operation: Execute Command
- Command is an Expression: ON
Command (Expression): Command (Expression):
``` ```
{{`set -euo pipefail; mkdir -p /srv/clipper/watch; URL="https://www.twitch.tv/videos/${$json.vodId ?? $json.id}"; yt-dlp --no-progress --remux-video mp4 -o "/srv/clipper/watch/%(id)s.%(ext)s" "$URL"`}} {{`set -euo pipefail; mkdir -p /srv/clipper/watch; URL="https://www.twitch.tv/videos/${$json.vodId ?? $json.id ?? $json.data?.id ?? $json.data?.[0]?.id}"; yt-dlp --no-progress --remux-video mp4 -o "/srv/clipper/watch/%(id)s.%(ext)s" "$URL"`}}
``` ```
Ergebnis: Ergebnis:
- `/srv/clipper/state/vod_seen.list` existiert und enthält die **erste** VOD-ID. - `/srv/clipper/state/vod_seen.list` existiert und enthält die **erste** VOD-ID (bei Regel 1).
- Für **jedes VOD** wird eine MP4 unter `/srv/clipper/watch/<VOD_ID>.mp4` gespeichert. - Für **jedes VOD** entsteht unter `/srv/clipper/watch/<VOD_ID>.mp4` eine MP4.
- Durch **Split Out Items + Combine (All Possible Combinations)** werden **alle VODs** zuverlässig durch den Pfad geführt. - Keine zusätzlichen Code-/Merge-Nodes nötig; der Pfad läuft **pro VOD** einmal über den Switch-Branch.