Plugin Architecture
Jellyfin plugins are .NET assemblies that implement the plugin interface and can:- Add metadata providers (movies, TV shows, music)
- Implement custom authentication providers
- Add new API endpoints
- React to server events
- Provide custom configuration pages
- Extend media scanning and organization
Plugin Structure
Plugins are located in theplugins/ directory within the Jellyfin data folder and follow this structure:
Creating a Plugin
1
Create a New .NET Project
Create a new class library targeting .NET 9.0:
2
Add Jellyfin Dependencies
Add references to Jellyfin packages:
MyPlugin.csproj
Check the Jellyfin NuGet feed for the latest package versions.
3
Implement the Plugin Class
Create your main plugin class by inheriting from
BasePlugin:Plugin.cs
4
Create Plugin Configuration
Define your plugin’s configuration class:
PluginConfiguration.cs
5
Build Your Plugin
Plugin Interface Reference
All plugins must implement theIPlugin interface defined in MediaBrowser.Common/Plugins/IPlugin.cs:
IPlugin Interface
BasePlugin Class
TheBasePlugin<TConfigurationType> class (from MediaBrowser.Common/Plugins/BasePlugin.cs) provides:
- Configuration Management: Automatic XML serialization/deserialization
- Data Folder Access: Isolated storage for plugin data
- Lifecycle Hooks:
OnUninstalling()method - Plugin Info: Automatic
PluginInfogeneration
Example: TMDb Metadata Plugin
Here’s how the built-in TMDb plugin is structured (seeMediaBrowser.Providers/Plugins/Tmdb/Plugin.cs):
TMDb Plugin Example
Adding Configuration Pages
ImplementIHasWebPages to provide a web-based configuration UI:
1
Implement IHasWebPages
2
Create Configuration HTML
Add an HTML file as an embedded resource:
Configuration/config.html
3
Embed the Resource
Update your
.csproj file:Plugin API Management
The Plugin API is managed through thePluginsController (see Jellyfin.Api/Controllers/PluginsController.cs):
Available Endpoints
- List Plugins
- Get Configuration
- Update Configuration
- Enable/Disable
- Uninstall
Advanced Plugin Features
Implementing Metadata Providers
Create custom metadata providers for movies, TV shows, or music:Reacting to Server Events
Subscribe to server events using dependency injection:Adding Scheduled Tasks
Installing Your Plugin
- Manual Installation
- Via Plugin Repository
- Development Mode
-
Build your plugin in Release mode:
-
Copy the DLL to the plugins folder:
- Restart Jellyfin Server
Debugging Plugins
1
Build with Debug Symbols
2
Attach Debugger
In Visual Studio or VS Code, attach to the running Jellyfin process.VS Code launch.json:
3
Set Breakpoints
Set breakpoints in your plugin code and trigger the functionality.
Plugin Best Practices
Handle Errors Gracefully
Always catch and log exceptions. Don’t crash the server with unhandled exceptions.
Use Dependency Injection
Request dependencies through constructor injection rather than creating instances directly.
Implement IDisposable
Clean up resources (event handlers, file handles, connections) when your plugin is unloaded.
Version Your Plugin
Use semantic versioning and test compatibility with different Jellyfin versions.
Document Configuration
Provide clear descriptions for all configuration options in your UI.
Respect Cancellation Tokens
Honor
CancellationToken parameters to allow graceful task cancellation.Plugin Examples
Study these built-in plugins in the Jellyfin source:- TMDb Plugin:
MediaBrowser.Providers/Plugins/Tmdb/- Metadata provider - MusicBrainz Plugin:
MediaBrowser.Providers/Plugins/MusicBrainz/- Music metadata - Studio Images Plugin:
MediaBrowser.Providers/Plugins/StudioImages/- Image provider - AudioDB Plugin:
MediaBrowser.Providers/Plugins/AudioDb/- Audio metadata
Testing Your Plugin
Create unit tests for your plugin:Next Steps
API Overview
Learn about the Jellyfin API your plugin can use
Contributing Guide
Submit your plugin to the official repository
Building from Source
Set up a development environment
Plugin Repository
Browse existing plugins and submission guidelines