From d9ca4ef2f196356527b128ed4e2176bbc83ee372 Mon Sep 17 00:00:00 2001 From: copyrights Date: Mon, 21 Apr 2025 22:45:00 +0200 Subject: [PATCH] add plan --- NextcloudPluginPlan.md | 91 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 91 insertions(+) create mode 100644 NextcloudPluginPlan.md diff --git a/NextcloudPluginPlan.md b/NextcloudPluginPlan.md new file mode 100644 index 0000000..6fd474d --- /dev/null +++ b/NextcloudPluginPlan.md @@ -0,0 +1,91 @@ +# Nextcloud/WebDAV Jellyfin Plugin Plan + +Below is a high-level plan for a Jellyfin plugin that integrates Nextcloud/WebDAV sources as library content. + +```mermaid +flowchart TD + subgraph Plugin Core + A[PluginConfiguration
– holds URL, creds, paths] + B[Plugin
– BasePlugin] + C[IPluginServiceRegistrator
– registers services] + D[IHostedService
– hook on startup] + end + + subgraph Services + E[WebDavClientService
– wraps WebDav.Client] + F[RemoteLibraryProvider
– implements virtual folder scanning] + G[CachingLayer
– buffer / temporary file cache] + H[StreamingController
– ControllerBase for proxying streams] + end + + subgraph Jellyfin Core + I[ILibraryManager
– library registration] + J[Scan Engine
– calls provider to enumerate items] + K[HTTP Pipeline
– routes to controllers] + end + + A --> B + B --> C + C --> E + C --> F + E --> F + F --> J + F --> G + G --> H + H --> K + D --> I + I --> J +``` + +## 1. Skeleton & Setup +- Copy the `jellyfin-plugin-template` and rename to `Jellyfin.Plugin.Nextcloud`. +- Update project metadata: plugin ID, name, version in `.csproj`. +- Add NuGet reference to `WebDav.Client`. + +## 2. Configuration & Dependency Injection +- Define `PluginConfiguration` with URL, credentials, root path, and cache settings. +- Implement `Plugin : BasePlugin` to override `Name`, `Id`, and inject DI. +- Create `IPluginServiceRegistrator` to register services: + - `WebDavClientService` (singleton) + - `RemoteLibraryProvider` (scanning) + - `StreamingController` (ASP.NET Controller) +- Register virtual folder with `ILibraryManager.RegisterVirtualFolder` on startup. + +## 3. Scanning Integration +- Research Jellyfin scan engine provider interfaces. +- Implement `RemoteLibraryProvider` to list directories/files via `WebDavClientService`. +- Map each remote item to a `BaseItem` (e.g., `Video`, `Folder`) with metadata. +- Track ETags or timestamps to support incremental scans. + +## 4. Streaming & Caching +- Create `StreamingController : ControllerBase` with endpoint `/WebDav/Stream/{itemId}`. +- Map `itemId` to remote path and stream via `WebDavClientService.GetStream`. +- Implement `CachingLayer` to buffer chunks and write to temp files to prevent stalls. + +## 5. Admin UI +- Define `configPage.html` as an embedded resource and implement `IHasWebPages` in `Plugin.cs` to return a `PluginPageInfo` for the settings page. +- Update `build.yaml` to include a `pages` section: + ```yaml + pages: + - name: WebDAV + embeddedResourcePath: Jellyfin.Plugin.Webdav.Configuration.configPage.html + ``` +- Rebuild the plugin so that MSBuild generates a `plugin.json` manifest containing the pages definition. +- Deploy the `plugin.json`, DLL, and dependencies to Jellyfin’s `plugins` folder. +- Restart Jellyfin to verify the “WebDAV” settings page appears under Admin → Plugins. + +## 6. Testing & Validation +- Unit-test `WebDavClientService` using a test Nextcloud instance or mock. +- Deploy plugin locally; verify library shows Nextcloud virtual folders. +- Test playback to ensure smooth streaming. + +## 7. Documentation & Release +- Write README with installation, configuration, and troubleshooting guidance. +- Bump version, package plugin (`.nupkg`), and publish to GitHub Releases. + +### Milestones +- **M1**: Plugin skeleton & DI wiring +- **M2**: Scanning proof-of-concept +- **M3**: Streaming proxy & caching +- **M4**: Admin UI & settings page +- **M5**: Testing, documentation, release \ No newline at end of file