diff --git a/.vscode/launch.json b/.vscode/launch.json index e132924..b60b151 100644 --- a/.vscode/launch.json +++ b/.vscode/launch.json @@ -7,7 +7,7 @@ "name": "Launch", "request": "launch", "preLaunchTask": "build-and-copy", - "program": "${config:jellyfinDir}/bin/Debug/net6.0/jellyfin.dll", + "program": "${config:jellyfinDir}/bin/Debug/net8.0/jellyfin.dll", "args": [ //"--nowebclient" "--webdir", diff --git a/.vscode/tasks.json b/.vscode/tasks.json index bff56d1..eaf8105 100644 --- a/.vscode/tasks.json +++ b/.vscode/tasks.json @@ -59,17 +59,17 @@ "command": "cp", "windows": { "args": [ - "./${config:pluginName}/bin/Debug/net6.0/publish/*", + "./${config:pluginName}/bin/Debug/net8.0/publish/*", "${config:jellyfinWindowsDataDir}/plugins/${config:pluginName}/" ] }, "linux": { "args": [ "-r", - "./${config:pluginName}/bin/Debug/net6.0/publish/*", + "./${config:pluginName}/bin/Debug/net8.0/publish/*", "${config:jellyfinLinuxDataDir}/plugins/${config:pluginName}/" ] } }, ] -} \ No newline at end of file +} diff --git a/Jellyfin.Plugin.Template.sln b/Jellyfin.Plugin.Template.sln index 241f725..7c9b9ee 100644 --- a/Jellyfin.Plugin.Template.sln +++ b/Jellyfin.Plugin.Template.sln @@ -1,15 +1,28 @@ Microsoft Visual Studio Solution File, Format Version 12.00 +# Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Jellyfin.Plugin.Template", "Jellyfin.Plugin.Template\Jellyfin.Plugin.Template.csproj", "{D921B930-CF91-406F-ACBC-08914DCD0D34}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 Release|Any CPU = Release|Any CPU + Release|x64 = Release|x64 + Release|x86 = Release|x86 EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {D921B930-CF91-406F-ACBC-08914DCD0D34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Debug|Any CPU.ActiveCfg = Debug|Any CPU {D921B930-CF91-406F-ACBC-08914DCD0D34}.Debug|Any CPU.Build.0 = Debug|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Debug|x64.ActiveCfg = Debug|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Debug|x64.Build.0 = Debug|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Debug|x86.ActiveCfg = Debug|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Debug|x86.Build.0 = Debug|Any CPU {D921B930-CF91-406F-ACBC-08914DCD0D34}.Release|Any CPU.ActiveCfg = Release|Any CPU {D921B930-CF91-406F-ACBC-08914DCD0D34}.Release|Any CPU.Build.0 = Release|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Release|x64.ActiveCfg = Release|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Release|x64.Build.0 = Release|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Release|x86.ActiveCfg = Release|Any CPU + {D921B930-CF91-406F-ACBC-08914DCD0D34}.Release|x86.Build.0 = Release|Any CPU EndGlobalSection EndGlobal diff --git a/Jellyfin.Plugin.Template/Jellyfin.Plugin.Template.csproj b/Jellyfin.Plugin.Template/Jellyfin.Plugin.Template.csproj index dff6ac9..ca996fb 100644 --- a/Jellyfin.Plugin.Template/Jellyfin.Plugin.Template.csproj +++ b/Jellyfin.Plugin.Template/Jellyfin.Plugin.Template.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 Jellyfin.Plugin.Template true true @@ -11,13 +11,13 @@ - - + + - + diff --git a/Jellyfin.Plugin.Template/Plugin.cs b/Jellyfin.Plugin.Template/Plugin.cs index b55d995..445c2bc 100644 --- a/Jellyfin.Plugin.Template/Plugin.cs +++ b/Jellyfin.Plugin.Template/Plugin.cs @@ -39,13 +39,13 @@ public class Plugin : BasePlugin, IHasWebPages /// public IEnumerable GetPages() { - return new[] - { + return + [ new PluginPageInfo { - Name = this.Name, + Name = Name, EmbeddedResourcePath = string.Format(CultureInfo.InvariantCulture, "{0}.Configuration.configPage.html", GetType().Namespace) } - }; + ]; } } diff --git a/README.md b/README.md index d8c46ef..fa7fce6 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,10 @@ # So you want to make a Jellyfin plugin -Awesome! This guide is for you. Jellyfin plugins are written using the dotnet standard framework. What that means is you can write them in any language that implements the CLI or the DLI and can compile to net6.0. The examples on this page are in C# because that is what most of Jellyfin is written in, but F#, Visual Basic, and IronPython should all be compatible once compiled. +Awesome! This guide is for you. Jellyfin plugins are written using the dotnet standard framework. What that means is you can write them in any language that implements the CLI or the DLI and can compile to net8.0. The examples on this page are in C# because that is what most of Jellyfin is written in, but F#, Visual Basic, and IronPython should all be compatible once compiled. ## 0. Things you need to get started -- [Dotnet SDK 6.0](https://dotnet.microsoft.com/download) +- [Dotnet SDK 8.0](https://dotnet.microsoft.com/download) - An editor of your choice. Some free choices are: @@ -39,7 +39,7 @@ If you'd rather start from scratch keep going on to step one. This assumes no sp Make a new dotnet standard project with the following command, it will make a directory for itself. ``` -dotnet new classlib -f net6.0 -n MyJellyfinPlugin +dotnet new classlib -f net8.0 -n MyJellyfinPlugin ``` Now add the Jellyfin shared libraries. @@ -126,7 +126,9 @@ If your plugin doesn't fit perfectly neatly into a predefined interface, never f - **IPluginConfigurationPage** - Allows you to have a plugin config page on the dashboard. If you used one of the quickstart example projects, a premade page with some useful components to work with has been created for you! If not you can check out this guide here for how to whip one up. -- **IServerEntryPoint** - Allows you to run code at server startup that will stay in memory. You can make as many of these as you need and it is wildly useful for loading configs or persisting state. **Be aware that your main plugin class (IBasePlugin) cannot also be a IServerEntryPoint.** + **IPluginServiceRegistrator** - Will be located by Jellyfin at server startup and allows you to add services to the DI container to allow for injection in your plugin's classes later. + +- **IHostedService** - Allows you to run code as a background task that will be started at program startup and will remain in memory. See [Microsoft's documentation](https://learn.microsoft.com/en-us/aspnet/core/fundamentals/host/hosted-services?view=aspnetcore-8.0&tabs=visual-studio#ihostedservice-interface) for more information. You can make as many of these as you need; make Jellyfin aware of them with an `IPluginServiceRegistrator`. It is wildly useful for loading configs or persisting state. **Be aware that your main plugin class (IBasePlugin) cannot also be a IHostedService.** - **ControllerBase** - Allows you to define custom REST-API endpoints. This is the default ASP.NET Web-API controller. You can use it exactly as you would in a normal Web-API project. Learn more about it [here](https://docs.microsoft.com/aspnet/core/web-api/?view=aspnetcore-5.0). @@ -220,7 +222,7 @@ This example expects you to clone `jellyfin`, `jellyfin-web` and `jellyfin-plugi "name": "Launch", "request": "launch", "preLaunchTask": "build-and-copy", - "program": "${config:jellyfinDir}/bin/Debug/net6.0/jellyfin.dll", + "program": "${config:jellyfinDir}/bin/Debug/net8.0/jellyfin.dll", "args": [ //"--nowebclient" "--webdir", @@ -288,7 +290,7 @@ This example expects you to clone `jellyfin`, `jellyfin-web` and `jellyfin-plugi "type": "shell", "command": "cp", "args": [ - "./${config:pluginName}/bin/Debug/net6.0/publish/*", + "./${config:pluginName}/bin/Debug/net8.0/publish/*", "${config:jellyfinDataDir}/plugins/${config:pluginName}/" ] @@ -356,7 +358,7 @@ This example expects you to clone `jellyfin`, `jellyfin-web` and `jellyfin-plugi "type": "shell", "command": "cp", "args": [ - "./${config:pluginName}/bin/Debug/net6.0/publish/*", + "./${config:pluginName}/bin/Debug/net8.0/publish/*", "${config:jellyfinDataDir}/plugins/${config:pluginName}/" ] }, diff --git a/build.yaml b/build.yaml index 4663cd4..168daa7 100644 --- a/build.yaml +++ b/build.yaml @@ -2,8 +2,8 @@ name: "Template" guid: "eb5d7894-8eef-4b36-aa6f-5d124e828ce1" version: "1.0.0.0" -targetAbi: "10.8.0.0" -framework: "net6.0" +targetAbi: "10.9.0.0" +framework: "net8.0" overview: "Short description about your plugin" description: > This is a longer description that can span more than one