3.5 KiB
3.5 KiB
Nextcloud/WebDAV Jellyfin Plugin Plan
Below is a high-level plan for a Jellyfin plugin that integrates Nextcloud/WebDAV sources as library content.
flowchart TD
subgraph Plugin Core
A[PluginConfiguration<br/>– holds URL, creds, paths]
B[Plugin<br/>– BasePlugin<Config>]
C[IPluginServiceRegistrator<br/>– registers services]
D[IHostedService<br/>– hook on startup]
end
subgraph Services
E[WebDavClientService<br/>– wraps WebDav.Client]
F[RemoteLibraryProvider<br/>– implements virtual folder scanning]
G[CachingLayer<br/>– buffer / temporary file cache]
H[StreamingController<br/>– ControllerBase for proxying streams]
end
subgraph Jellyfin Core
I[ILibraryManager<br/>– library registration]
J[Scan Engine<br/>– calls provider to enumerate items]
K[HTTP Pipeline<br/>– 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-templateand rename toJellyfin.Plugin.Nextcloud. - Update project metadata: plugin ID, name, version in
.csproj. - Add NuGet reference to
WebDav.Client.
2. Configuration & Dependency Injection
- Define
PluginConfigurationwith URL, credentials, root path, and cache settings. - Implement
Plugin : BasePlugin<PluginConfiguration>to overrideName,Id, and inject DI. - Create
IPluginServiceRegistratorto register services:WebDavClientService(singleton)RemoteLibraryProvider(scanning)StreamingController(ASP.NET Controller)
- Register virtual folder with
ILibraryManager.RegisterVirtualFolderon startup.
3. Scanning Integration
- Research Jellyfin scan engine provider interfaces.
- Implement
RemoteLibraryProviderto list directories/files viaWebDavClientService. - 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 : ControllerBasewith endpoint/WebDav/Stream/{itemId}. - Map
itemIdto remote path and stream viaWebDavClientService.GetStream. - Implement
CachingLayerto buffer chunks and write to temp files to prevent stalls.
5. Admin UI
- Define
configPage.htmlas an embedded resource and implementIHasWebPagesinPlugin.csto return aPluginPageInfofor the settings page. - Update
build.yamlto include apagessection:pages: - name: WebDAV embeddedResourcePath: Jellyfin.Plugin.Webdav.Configuration.configPage.html - Rebuild the plugin so that MSBuild generates a
plugin.jsonmanifest containing the pages definition. - Deploy the
plugin.json, DLL, and dependencies to Jellyfin’spluginsfolder. - Restart Jellyfin to verify the “WebDAV” settings page appears under Admin → Plugins.
6. Testing & Validation
- Unit-test
WebDavClientServiceusing 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