Kapitel 13/Tutorial.md aktualisiert
This commit is contained in:
@@ -374,7 +374,7 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
|||||||
{"file_exists":true,"non_empty":false,"vods":[]}
|
{"file_exists":true,"non_empty":false,"vods":[]}
|
||||||
{"file_exists":true,"non_empty":true,"vods":["123456789","987654321"]}
|
{"file_exists":true,"non_empty":true,"vods":["123456789","987654321"]}
|
||||||
```
|
```
|
||||||
**5. Set Node – Felder übernehmen
|
5. ** Set Node – Felder übernehmen **
|
||||||
|
|
||||||
### Set Node – Felder übernehmen
|
### Set Node – Felder übernehmen
|
||||||
|
|
||||||
@@ -387,7 +387,7 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
|||||||
> Aktiviere die Option: Add Option → Ignore Type Conversion Errors → einschalten.
|
> Aktiviere die Option: Add Option → Ignore Type Conversion Errors → einschalten.
|
||||||
|
|
||||||
|
|
||||||
**6. If-Node – zwei klare Wege
|
6. ** If-Node – zwei klare Wege **
|
||||||
|
|
||||||
In diesem Schritt legen wir die Entscheidungspfade in einem **If-Node** an. Dafür werden zwei Bedigungen hinzugefügt, die jeweils einen klar benannten Output erzeugen.
|
In diesem Schritt legen wir die Entscheidungspfade in einem **If-Node** an. Dafür werden zwei Bedigungen hinzugefügt, die jeweils einen klar benannten Output erzeugen.
|
||||||
|
|
||||||
@@ -403,7 +403,7 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
|||||||
```
|
```
|
||||||
Damit hat der if-Node zwei klar angesprochene Ausgänge, die die weitere Logik steuern.
|
Damit hat der if-Node zwei klar angesprochene Ausgänge, die die weitere Logik steuern.
|
||||||
|
|
||||||
**7. False - Download
|
7. ** False - Download **
|
||||||
Ziel: n8n erkennt neue VODs, erstellt/aktualisiert die State-Datei und lädt jedes VOD **sequenziell** im Clipper herunter und direkt in **Nextcloud** hoch (mit automatischem Aufräumen und Logfiles). Alles wird von n8n gesteuert, die Dateiübertragung übernimmt **rclone** im Clipper.
|
Ziel: n8n erkennt neue VODs, erstellt/aktualisiert die State-Datei und lädt jedes VOD **sequenziell** im Clipper herunter und direkt in **Nextcloud** hoch (mit automatischem Aufräumen und Logfiles). Alles wird von n8n gesteuert, die Dateiübertragung übernimmt **rclone** im Clipper.
|
||||||
|
|
||||||
---
|
---
|
||||||
@@ -536,16 +536,15 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
|||||||
|
|
||||||
**Verkabelung (Kurzüberblick):**
|
**Verkabelung (Kurzüberblick):**
|
||||||
1) HTTP Request →
|
1) HTTP Request →
|
||||||
2) Item Lists: Split Out (data) →
|
2) Item Lists: →
|
||||||
3) Switch (Pfad: CREATE_AND_DOWNLOAD) →
|
3) Merge →
|
||||||
4) Merge (Combine → All Possible Combinations) →
|
4) Split In Batches →
|
||||||
5) Split In Batches (1) →
|
5) SSH Node 1 (State-Datei schreiben) →
|
||||||
6) SSH Node 1 (State-Datei schreiben) →
|
6) SSH Node 2 (Download & Upload)
|
||||||
7) SSH Node 2 (Download & Upload)
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
**D. Node-Einstellungen (1:1 in n8n eintragen)**
|
** Node-Einstellungen (1:1 in n8n eintragen)**
|
||||||
|
|
||||||
**1) HTTP Request – Get Videos**
|
**1) HTTP Request – Get Videos**
|
||||||
- **Node-Typ:** HTTP Request
|
- **Node-Typ:** HTTP Request
|
||||||
@@ -563,26 +562,18 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
|||||||
- **Operation:** Split Out Items
|
- **Operation:** Split Out Items
|
||||||
- **Field to Split Out:** `data`
|
- **Field to Split Out:** `data`
|
||||||
|
|
||||||
**3) Switch – Pfadwahl**
|
**3) Merge – Combine**
|
||||||
- **Node-Typ:** Switch
|
|
||||||
- **Property Name:**
|
|
||||||
```
|
|
||||||
{{ $json.state }}
|
|
||||||
```
|
|
||||||
- **Gültiger Pfad für Pfad 1:** `CREATE_AND_DOWNLOAD`
|
|
||||||
|
|
||||||
**4) Merge – Combine**
|
|
||||||
- **Node-Typ:** Merge
|
- **Node-Typ:** Merge
|
||||||
- **Mode:** Combine
|
- **Mode:** Combine
|
||||||
- **Combine Mode:** All Possible Combinations
|
- **Combine Mode:** All Possible Combinations
|
||||||
- **Eingang 1:** Switch (Ausgang: CREATE_AND_DOWNLOAD)
|
- **Eingang 1:** Switch (Ausgang: CREATE_AND_DOWNLOAD)
|
||||||
- **Eingang 2:** Item Lists: Split Out
|
- **Eingang 2:** Item Lists: Split Out
|
||||||
|
|
||||||
**5) Split In Batches**
|
**4) Split In Batches**
|
||||||
- **Node-Typ:** Split In Batches
|
- **Node-Typ:** Split In Batches
|
||||||
- **Batch Size:** `1`
|
- **Batch Size:** `1`
|
||||||
|
|
||||||
**6) SSH Node 1 – State-Datei schreiben**
|
**5) SSH Node 1 – State-Datei schreiben**
|
||||||
- **Node-Typ:** SSH
|
- **Node-Typ:** SSH
|
||||||
- **Credentials:** *SSH Clipper* (User = `clipper`)
|
- **Credentials:** *SSH Clipper* (User = `clipper`)
|
||||||
- **Operation:** Execute Command
|
- **Operation:** Execute Command
|
||||||
@@ -592,7 +583,7 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
|||||||
{{`set -euo pipefail; STATE="/srv/clipper/state/vod_seen.list"; mkdir -p "$(dirname "$STATE")"; if [ -s "$STATE" ]; then printf "%s\n" "${$json.data.id}" >> "$STATE"; else printf "%s\n" "${$json.data.id}" > "$STATE"; fi`}}
|
{{`set -euo pipefail; STATE="/srv/clipper/state/vod_seen.list"; mkdir -p "$(dirname "$STATE")"; if [ -s "$STATE" ]; then printf "%s\n" "${$json.data.id}" >> "$STATE"; else printf "%s\n" "${$json.data.id}" > "$STATE"; fi`}}
|
||||||
```
|
```
|
||||||
|
|
||||||
**7) SSH Node 2 – Download & Upload (Skript)**
|
**6) SSH Node 2 – Download & Upload (Skript)**
|
||||||
- **Node-Typ:** SSH
|
- **Node-Typ:** SSH
|
||||||
- **Credentials:** *SSH Clipper* (User = `clipper`)
|
- **Credentials:** *SSH Clipper* (User = `clipper`)
|
||||||
- **Operation:** Execute Command
|
- **Operation:** Execute Command
|
||||||
@@ -611,3 +602,37 @@ Im Ergebnis findest du im Feld `data[0].id` deine **User-ID** (z. B. `123456789`
|
|||||||
- Pro VOD gibt es ein eigenes Logfile unter `<clipper-ordner>/logs/<ID>.log`.
|
- Pro VOD gibt es ein eigenes Logfile unter `<clipper-ordner>/logs/<ID>.log`.
|
||||||
- Lokaler Speicher bleibt frei (automatisches Löschen nach Upload).
|
- Lokaler Speicher bleibt frei (automatisches Löschen nach Upload).
|
||||||
- Logs der Schritte findest du im SSH‑Node‑Output und persistent im Logfile.
|
- Logs der Schritte findest du im SSH‑Node‑Output und persistent im Logfile.
|
||||||
|
|
||||||
|
8. ** True-Pfad - Check und ggf. Download
|
||||||
|
|
||||||
|
**Verkabelung (Kurzüberblick):**
|
||||||
|
1) HTTP Request →
|
||||||
|
2) Item Lists →
|
||||||
|
3) Set – vods in Array →
|
||||||
|
4) Split Arry Out →
|
||||||
|
5) Merge →
|
||||||
|
6) Split In Batches →
|
||||||
|
7) SSH Node 1 (State-Datei schreiben) →
|
||||||
|
8) SSH Node 2 (Download & Upload)
|
||||||
|
|
||||||
|
** Node-Einstellungen (1:1 in n8n eintragen)**
|
||||||
|
**1) HTTP Request – Get Videos**
|
||||||
|
- **Node-Typ:** HTTP Request
|
||||||
|
- **Methode:** GET
|
||||||
|
- **URL:**
|
||||||
|
```
|
||||||
|
https://api.twitch.tv/helix/videos?user_id=<DEINE_TWITCH_USER_ID>&type=archive&first=20
|
||||||
|
```
|
||||||
|
- **Authentifizierung:** OAuth2 (Credential: *Twitch API*)
|
||||||
|
- **Header:** `Client-Id: <DEINE_CLIENT_ID>`
|
||||||
|
- **Response Format:** JSON
|
||||||
|
|
||||||
|
**2) Item Lists – Split Out**
|
||||||
|
- **Node-Typ:** Split Out
|
||||||
|
- **Field to Split Out:** `data`
|
||||||
|
|
||||||
|
**3) Set – vods in Array**
|
||||||
|
- **Node-Typ:** Edit Fields (set)
|
||||||
|
- **Field:** vods
|
||||||
|
- **Type:** Arry
|
||||||
|
- **Expression** `{{ (typeof $json.vods === 'string' ? $json.vods : String($json.vods)) .split(',') .map(s => s.trim()) .filter(Boolean) }}`
|
||||||
|
|||||||
Reference in New Issue
Block a user