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
Verkabelung (ein einzelnes VOD):
- Switch-Output **CREATE_AND_DOWNLOAD** → **Merge (Combine → All Possible Combinations)** (Eingang 1)
- **HTTP Request: VOD-Daten abrufen** → **Item Lists: Split Out Items (Input = data)** → **Merge (Combine → All Possible Combinations)** (Eingang 2)
- **Merge (Combine → All Possible Combinations)** → **SSH: State-Datei anlegen** → **SSH: VOD herunterladen (yt-dlp)**
Verkabelung (mehrere VODs einfach & klar):
- **HTTP Request: VODs abrufen** → **Split Out** (Field to Split Out: `data`)
- **Split Out** → **Switch (Regeln aus Punkt 7)**
- **Switch → Output CREATE_AND_DOWNLOAD** → **SSH: State-Datei anlegen** → **SSH: VOD herunterladen (yt-dlp)**
> [!NOTE]
> 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.
Item Lists Einstellungen (nach dem HTTP Request):
- Typ: Item Lists
Split Out Einstellungen:
- Node: **Split Out**
- Operation: **Split Out Items**
- Field to Split Out: **data**
- **Field to Split Out:** `data`
Merge Einstellungen:
- 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
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):
```
{{`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):
- Typ: SSH
- Credentials: SSH Clipper
- Operation: Execute Command
- Command is an Expression: ON
- Typ: SSH • Credentials: SSH Clipper • Operation: Execute Command • Command is an Expression: ON
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:
- `/srv/clipper/state/vod_seen.list` existiert und enthält die **erste** VOD-ID.
- Für **jedes VOD** wird eine MP4 unter `/srv/clipper/watch/<VOD_ID>.mp4` gespeichert.
- Durch **Split Out Items + Combine (All Possible Combinations)** werden **alle VODs** zuverlässig durch den Pfad geführt.
- `/srv/clipper/state/vod_seen.list` existiert und enthält die **erste** VOD-ID (bei Regel 1).
- Für **jedes VOD** entsteht unter `/srv/clipper/watch/<VOD_ID>.mp4` eine MP4.
- Keine zusätzlichen Code-/Merge-Nodes nötig; der Pfad läuft **pro VOD** einmal über den Switch-Branch.