50e8519220
- Add 6 renderer components: StatCard, Gauge, List, Progress, AlertBanner, Chart - Add IntegrationWidget container with auto-refresh, loading, error states - Add IntegrationAlertOverlay for layout-level critical alerts - Add IntegrationConfigFields for dynamic form generation from Zod schemas - Register integration type in WidgetRenderer - Extend WidgetCreationForm with integration app/endpoint pickers - Extend AppForm with integration config section and test connection button - Add /api/integrations/alerts endpoint
70 lines
4.4 KiB
Markdown
70 lines
4.4 KiB
Markdown
# Phase 9: Media Integrations (Emby + Immich + Deluge + MeTube)
|
|
|
|
**Status:** ⬜ Not Started
|
|
**Parent plan:** [PLAN.md](./PLAN.md)
|
|
**Domain:** backend
|
|
|
|
## Objective
|
|
Implement four media-related integrations bundled together since each is relatively small: Emby (media server), Immich (photo management), Deluge (torrent client), and MeTube (video downloader).
|
|
|
|
## Tasks
|
|
|
|
### Emby
|
|
- [ ] Task 1: Create `src/lib/server/integrations/emby/schema.ts` — Auth config: `{ apiKey: string }`.
|
|
- [ ] Task 2: Create `src/lib/server/integrations/emby/client.ts` — HTTP client. Endpoints: `/emby/Sessions?api_key=<key>`, `/emby/Items/Counts?api_key=<key>`, `/emby/Items/Latest?api_key=<key>`.
|
|
- [ ] Task 3: Create `src/lib/server/integrations/emby/transform.ts` — Now playing → list (user, title, transcode/direct, quality), library stats → stat-card (movies, shows, episodes), recently added → list with titles.
|
|
- [ ] Task 4: Create `src/lib/server/integrations/emby/index.ts` — Endpoints: `now-playing` (list), `library-stats` (stat-card), `recently-added` (list), `active-streams` (stat-card).
|
|
|
|
### Immich
|
|
- [ ] Task 5: Create `src/lib/server/integrations/immich/schema.ts` — Auth config: `{ apiKey: string }`.
|
|
- [ ] Task 6: Create `src/lib/server/integrations/immich/client.ts` — HTTP client. Auth via `x-api-key` header. Endpoints: `/api/server-info/statistics`, `/api/assets?order=desc&limit=10`, `/api/memories`.
|
|
- [ ] Task 7: Create `src/lib/server/integrations/immich/transform.ts` — Library stats → stat-card (photos, videos, storage), recent uploads → list, memory of day → stat-card.
|
|
- [ ] Task 8: Create `src/lib/server/integrations/immich/index.ts` — Endpoints: `library-stats` (stat-card), `recent-uploads` (list), `memory-of-day` (stat-card).
|
|
|
|
### Deluge
|
|
- [ ] Task 9: Create `src/lib/server/integrations/deluge/schema.ts` — Auth config: `{ password: string }`.
|
|
- [ ] Task 10: Create `src/lib/server/integrations/deluge/client.ts` — JSON-RPC client at `{app.url}/json`. Auth flow: call `auth.login` first, then `web.update_ui` / `core.get_torrents_status`. Handle session cookie.
|
|
- [ ] Task 11: Create `src/lib/server/integrations/deluge/transform.ts` — Active torrents → progress list (name, %, speed), transfer speed → gauge, disk space → gauge.
|
|
- [ ] Task 12: Create `src/lib/server/integrations/deluge/index.ts` — Endpoints: `active-torrents` (progress), `transfer-speed` (gauge), `disk-space` (gauge).
|
|
|
|
### MeTube
|
|
- [ ] Task 13: Create `src/lib/server/integrations/metube/schema.ts` — Auth config: `{}` (no auth).
|
|
- [ ] Task 14: Create `src/lib/server/integrations/metube/client.ts` — HTTP client. Endpoint: `/api/history`, `/api/queue`.
|
|
- [ ] Task 15: Create `src/lib/server/integrations/metube/transform.ts` — Download queue → progress list (title, %, status).
|
|
- [ ] Task 16: Create `src/lib/server/integrations/metube/index.ts` — Endpoints: `download-queue` (progress).
|
|
|
|
### Registration
|
|
- [ ] Task 17: Register all four integrations in registry.
|
|
|
|
## Files to Modify/Create
|
|
- `src/lib/server/integrations/emby/{schema,client,transform,index}.ts` — new (4 files)
|
|
- `src/lib/server/integrations/immich/{schema,client,transform,index}.ts` — new (4 files)
|
|
- `src/lib/server/integrations/deluge/{schema,client,transform,index}.ts` — new (4 files)
|
|
- `src/lib/server/integrations/metube/{schema,client,transform,index}.ts` — new (4 files)
|
|
- `src/lib/server/integrations/registry.ts` — modify: register all four
|
|
|
|
## Acceptance Criteria
|
|
- All four integrations fetch and transform data correctly
|
|
- Emby: now playing, library stats, recently added
|
|
- Immich: library stats, recent uploads, memory of day
|
|
- Deluge: active torrents with progress, transfer speed, disk space
|
|
- MeTube: download queue with progress
|
|
- Deluge JSON-RPC auth flow handles session cookies
|
|
- MeTube works without any auth
|
|
- All test connections validate properly
|
|
|
|
## Notes
|
|
- Deluge JSON-RPC is the trickiest — requires auth.login call first, then session cookie for subsequent calls
|
|
- MeTube has a very limited API — may need to poll /api/queue for real-time data
|
|
- Immich API versions change frequently — target current stable
|
|
- Emby API key goes in query string, not header
|
|
|
|
## Review Checklist
|
|
- [ ] All tasks completed
|
|
- [ ] Deluge session handling is robust
|
|
- [ ] Code follows project conventions
|
|
- [ ] Each integration is self-contained in its directory
|
|
|
|
## Handoff to Next Phase
|
|
<!-- Filled in after completion -->
|