Bugfix and Docs

This commit is contained in:
2026-03-10 13:12:57 +00:00
parent 3516ff8486
commit ac4d77dddf
75 changed files with 3511 additions and 5142 deletions

View File

@@ -1,23 +1,23 @@
# History API
Endpunkte für die Job-Histoire, Dateimanagement und Orphan-Import.
Endpunkte für Job-Historie, Orphan-Import und Löschoperationen.
---
## GET /api/history
Gibt eine Liste aller Jobs zurück, optional gefiltert.
Liefert Jobs (optionale Filter).
**Query-Parameter:**
| Parameter | Typ | Beschreibung |
|----------|-----|-------------|
| `status` | string | Filtert nach Status (z.B. `FINISHED`, `ERROR`) |
| `search` | string | Sucht in Filmtiteln |
| `status` | string | Filter nach Job-Status |
| `search` | string | Suche in Titel-Feldern |
**Beispiel:**
```
```text
GET /api/history?status=FINISHED&search=Inception
```
@@ -30,17 +30,15 @@ GET /api/history?status=FINISHED&search=Inception
"id": 42,
"status": "FINISHED",
"title": "Inception",
"imdb_id": "tt1375666",
"omdb_year": "2010",
"omdb_type": "movie",
"omdb_poster": "https://...",
"raw_path": "/mnt/nas/raw/Inception_t00.mkv",
"output_path": "/mnt/nas/movies/Inception (2010).mkv",
"created_at": "2024-01-15T10:00:00.000Z",
"updated_at": "2024-01-15T12:30:00.000Z"
"raw_path": "/mnt/raw/Inception - RAW - job-42",
"output_path": "/mnt/movies/Inception (2010)/Inception (2010).mkv",
"mediaType": "bluray",
"ripSuccessful": true,
"encodeSuccess": true,
"created_at": "2026-03-10T08:00:00.000Z",
"updated_at": "2026-03-10T10:00:00.000Z"
}
],
"total": 1
]
}
```
@@ -48,34 +46,37 @@ GET /api/history?status=FINISHED&search=Inception
## GET /api/history/:id
Gibt Detail-Informationen für einen einzelnen Job zurück.
**URL-Parameter:** `id` Job-ID
Liefert Job-Detail.
**Query-Parameter:**
| Parameter | Typ | Standard | Beschreibung |
|----------|-----|---------|-------------|
| `includeLogs` | boolean | `false` | Log-Inhalte einschließen |
| `includeLiveLog` | boolean | `false` | Aktuellen Live-Log einschließen |
| `includeLogs` | bool | `false` | Prozesslog laden |
| `includeLiveLog` | bool | `false` | alias-artig ebenfalls Prozesslog laden |
| `includeAllLogs` | bool | `false` | vollständiges Log statt Tail |
| `logTailLines` | number | `800` | Tail-Länge falls nicht `includeAllLogs` |
**Response:**
```json
{
"id": 42,
"status": "FINISHED",
"title": "Inception",
"imdb_id": "tt1375666",
"encode_plan": { ... },
"makemkv_output": { ... },
"mediainfo_output": { ... },
"handbrake_log": "/path/to/log",
"logs": {
"handbrake": "Encoding: task 1 of 1, 100.0%\n..."
},
"created_at": "2024-01-15T10:00:00.000Z",
"updated_at": "2024-01-15T12:30:00.000Z"
"job": {
"id": 42,
"status": "FINISHED",
"makemkvInfo": {},
"mediainfoInfo": {},
"handbrakeInfo": {},
"encodePlan": {},
"log": "...",
"log_count": 1,
"logMeta": {
"loaded": true,
"total": 800,
"returned": 800,
"truncated": true
}
}
}
```
@@ -83,14 +84,19 @@ Gibt Detail-Informationen für einen einzelnen Job zurück.
## GET /api/history/database
Gibt alle rohen Datenbankzeilen zurück (Debug-Ansicht).
Debug-Ansicht der DB-Zeilen (angereichert).
**Response:**
```json
{
"jobs": [ { "id": 1, "status": "FINISHED", ... } ],
"total": 15
"rows": [
{
"id": 42,
"status": "FINISHED",
"rawFolderName": "Inception - RAW - job-42"
}
]
}
```
@@ -98,18 +104,25 @@ Gibt alle rohen Datenbankzeilen zurück (Debug-Ansicht).
## GET /api/history/orphan-raw
Findet Raw-Ordner, die nicht als Jobs in der Datenbank registriert sind.
Sucht RAW-Ordner ohne zugehörigen Job.
**Response:**
```json
{
"orphans": [
"rawDir": "/mnt/raw",
"rawDirs": ["/mnt/raw", "/mnt/raw-bluray"],
"rows": [
{
"path": "/mnt/nas/raw/UnknownMovie_2023-12-01",
"size": "45.2 GB",
"modifiedAt": "2023-12-01T15:00:00.000Z",
"files": ["t00.mkv", "t01.mkv"]
"rawPath": "/mnt/raw/Inception (2010) [tt1375666] - RAW - job-99",
"folderName": "Inception (2010) [tt1375666] - RAW - job-99",
"title": "Inception",
"year": 2010,
"imdbId": "tt1375666",
"folderJobId": 99,
"entryCount": 4,
"hasBlurayStructure": true,
"lastModifiedAt": "2026-03-10T09:00:00.000Z"
}
]
}
@@ -119,35 +132,28 @@ Findet Raw-Ordner, die nicht als Jobs in der Datenbank registriert sind.
## POST /api/history/orphan-raw/import
Importiert einen Orphan-Raw-Ordner als Job in die Datenbank.
Importiert RAW-Ordner als FINISHED-Job.
**Request:**
```json
{
"path": "/mnt/nas/raw/UnknownMovie_2023-12-01"
}
{ "rawPath": "/mnt/raw/Inception (2010) [tt1375666] - RAW - job-99" }
```
**Response:**
```json
{
"ok": true,
"jobId": 99,
"message": "Orphan-Ordner als Job importiert"
"job": { "id": 77, "status": "FINISHED" },
"uiReset": { "reset": true, "state": "IDLE" }
}
```
Nach dem Import kann dem Job über `/api/history/:id/omdb/assign` Metadaten zugewiesen werden.
---
## POST /api/history/:id/omdb/assign
Weist einem bestehenden Job OMDb-Metadaten nachträglich zu.
**URL-Parameter:** `id` Job-ID
Weist OMDb-/Metadaten nachträglich zu.
**Request:**
@@ -155,44 +161,42 @@ Weist einem bestehenden Job OMDb-Metadaten nachträglich zu.
{
"imdbId": "tt1375666",
"title": "Inception",
"year": "2010",
"type": "movie",
"poster": "https://..."
"year": 2010,
"poster": "https://...",
"fromOmdb": true
}
```
**Response:**
```json
{ "ok": true }
{ "job": { "id": 42, "imdb_id": "tt1375666" } }
```
---
## POST /api/history/:id/delete-files
Löscht die Dateien eines Jobs (Raw und/oder Output), behält den Job-Eintrag.
**URL-Parameter:** `id` Job-ID
Löscht Dateien eines Jobs, behält DB-Eintrag.
**Request:**
```json
{
"deleteRaw": true,
"deleteOutput": false
}
{ "target": "both" }
```
`target`: `raw` | `movie` | `both`
**Response:**
```json
{
"ok": true,
"deleted": {
"raw": "/mnt/nas/raw/Inception_t00.mkv",
"output": null
}
"summary": {
"target": "both",
"raw": { "attempted": true, "deleted": true, "filesDeleted": 12, "dirsRemoved": 3, "reason": null },
"movie": { "attempted": true, "deleted": false, "filesDeleted": 0, "dirsRemoved": 0, "reason": "Movie-Datei/Pfad existiert nicht." }
},
"job": { "id": 42 }
}
```
@@ -200,23 +204,38 @@ Löscht die Dateien eines Jobs (Raw und/oder Output), behält den Job-Eintrag.
## POST /api/history/:id/delete
Löscht den Job-Eintrag aus der Datenbank, optional auch die Dateien.
**URL-Parameter:** `id` Job-ID
Löscht Job aus DB; optional auch Dateien.
**Request:**
```json
{
"deleteFiles": true
}
{ "target": "none" }
```
`target`: `none` | `raw` | `movie` | `both`
**Response:**
```json
{ "ok": true, "message": "Job gelöscht" }
{
"deleted": true,
"jobId": 42,
"fileTarget": "both",
"fileSummary": {
"target": "both",
"raw": { "filesDeleted": 10 },
"movie": { "filesDeleted": 1 }
},
"uiReset": {
"reset": true,
"state": "IDLE"
}
}
```
!!! warning "Unwiderruflich"
Das Löschen von Jobs und Dateien ist nicht rückgängig zu machen.
---
## Hinweise
- Ein aktiver Pipeline-Job kann nicht gelöscht werden (`409`).
- Alle Löschoperationen sind irreversibel.