Added the files to build a dotnet template
This commit is contained in:
parent
5af09f0fd5
commit
1e38d3a856
23
dotnet-template/content/.template.config/template.json
Normal file
23
dotnet-template/content/.template.config/template.json
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
{
|
||||||
|
"$schema": "http://json.schemastore.org/template",
|
||||||
|
"author": "Jellyfin Team",
|
||||||
|
"classifications": [ "NetStandard", "Plugin", "Jellyfin" ],
|
||||||
|
"tags": {
|
||||||
|
"language": "C#",
|
||||||
|
"type":"project"
|
||||||
|
},
|
||||||
|
"identity": "Jellyfin.Plugin",
|
||||||
|
"name": "Jellyfin Plugin template",
|
||||||
|
"shortName": "jellyfin-plugin",
|
||||||
|
"sourceName": "dotnet_template",
|
||||||
|
"symbols":{
|
||||||
|
"pluginGuid":{
|
||||||
|
"type": "generated",
|
||||||
|
"generator": "guid",
|
||||||
|
"replaces": "pluginguid",
|
||||||
|
"parameters": {
|
||||||
|
"format":"D"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
24
dotnet-template/content/Configuration/PluginConfiguration.cs
Normal file
24
dotnet-template/content/Configuration/PluginConfiguration.cs
Normal file
@ -0,0 +1,24 @@
|
|||||||
|
using MediaBrowser.Model.Plugins;
|
||||||
|
namespace Jellyfin.Plugin.dotnet_template.Configuration
|
||||||
|
{
|
||||||
|
public enum SomeOptions
|
||||||
|
{
|
||||||
|
OneOption,
|
||||||
|
AnotherOption
|
||||||
|
}
|
||||||
|
public class PluginConfiguration : BasePluginConfiguration
|
||||||
|
{
|
||||||
|
//This is where you should store configurable settings your plugin might need.
|
||||||
|
public bool TrueFalseSetting {get; set;}
|
||||||
|
public int AnInteger {get; set;}
|
||||||
|
public string AString {get; set;}
|
||||||
|
public SomeOptions Options {get; set;}
|
||||||
|
public PluginConfiguration()
|
||||||
|
{
|
||||||
|
Options = SomeOptions.AnotherOption;
|
||||||
|
TrueFalseSetting = true;
|
||||||
|
AnInteger = 5;
|
||||||
|
AString = "This is a string setting";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
98
dotnet-template/content/Configuration/configPage.html
Normal file
98
dotnet-template/content/Configuration/configPage.html
Normal file
@ -0,0 +1,98 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
|
||||||
|
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
|
||||||
|
<head>
|
||||||
|
<meta charset="utf-8" />
|
||||||
|
<title>dotnet_template Configuration</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div id="dotnet_templateConfigurationPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button,emby-select,emby-checkbox">
|
||||||
|
<div data-role="content">
|
||||||
|
<div class="content-primary">
|
||||||
|
|
||||||
|
<form id="dotnet_templateConfigurationForm">
|
||||||
|
<div class="selectContainer">
|
||||||
|
<label class="selectLabel" for="Options">Options:</label>
|
||||||
|
<select is="emby-select" id="Options" name="Options" class="emby-select-withcolor emby-select">
|
||||||
|
<option id="optOneOption" value="OneOption">One Option</option>
|
||||||
|
<option id="optAnotherOption" value="AnotherOption">AnotherOption</option>
|
||||||
|
</select>
|
||||||
|
</div>
|
||||||
|
<div class="inputContainer">
|
||||||
|
<label class="inputeLabel inputLabelUnfocused" for="AnInteger">An Integer:</label>
|
||||||
|
<input id="AnInteger" name="AnInteger" type="number" is="emby-input" min="0"/>
|
||||||
|
<div class="fieldDescription">Numbers go here</div>
|
||||||
|
</div>
|
||||||
|
<div class="checkboxContainer checkboxContainer-withDescripton">
|
||||||
|
<label class="emby-checkbox-label">
|
||||||
|
<input id="TrueFalseSetting" name="TrueFalseCheckBox" type="checkbox" is="emby-checkbox"/>
|
||||||
|
<span>True or False</span>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
<div class="inputContainer">
|
||||||
|
<label class="inputeLabel inputLabelUnfocused" for="AString">A String:</label>
|
||||||
|
<input id="AString" name="AString" type="text" is="emby-input" />
|
||||||
|
<div class="fieldDescription">Words go here</div>
|
||||||
|
</div>
|
||||||
|
<div>
|
||||||
|
<button is="emby-button" type="submit" class="raised button-submit block emby-button">
|
||||||
|
<span>Save</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<script type="text/javascript">
|
||||||
|
var dotnet_templateConfigurationPage =
|
||||||
|
{
|
||||||
|
pluginUniqueId: "pluginguid",
|
||||||
|
|
||||||
|
virtualFolders: [],
|
||||||
|
physicalFolders: [],
|
||||||
|
|
||||||
|
loadConfiguration: function() {
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
|
ApiClient.getPluginConfiguration(dotnet_templateConfigurationPage.pluginUniqueId).then(function (config) {
|
||||||
|
var page = $.mobile.activePage;
|
||||||
|
|
||||||
|
$('#Options', page).val(config.Options).change();
|
||||||
|
$('#AnInteger', page).val(config.AnInteger).change();
|
||||||
|
$('#TrueFalseSetting', page).checked(config.TrueFalseSetting).checkboxradio("refresh");
|
||||||
|
$('#AString', page).val(config.AString).change();
|
||||||
|
|
||||||
|
Dashboard.hideLoadingMsg();
|
||||||
|
});
|
||||||
|
},
|
||||||
|
|
||||||
|
saveConfiguration: function() {
|
||||||
|
Dashboard.showLoadingMsg();
|
||||||
|
|
||||||
|
var page = $.mobile.activePage;
|
||||||
|
|
||||||
|
ApiClient.getPluginConfiguration(dotnet_templateConfigurationPage.pluginUniqueId).then(function(config) {
|
||||||
|
|
||||||
|
config.Options = $('#Options', page).val();
|
||||||
|
config.AnInteger = $('#AnInteger').val();
|
||||||
|
config.TrueFalseSetting = $('#TrueFalseSetting').prop('checked');
|
||||||
|
config.AString = $('#AString').val();
|
||||||
|
ApiClient.updatePluginConfiguration(dotnet_templateConfigurationPage.pluginUniqueId, config).then(function (result) {
|
||||||
|
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
$('#dotnet_templateConfigurationPage').on('pageshow', function () {
|
||||||
|
dotnet_templateConfigurationPage.loadConfiguration();
|
||||||
|
});
|
||||||
|
|
||||||
|
$('#dotnet_templateConfigurationForm').on('submit', function () {
|
||||||
|
dotnet_templateConfigurationPage.saveConfiguration();
|
||||||
|
return false;
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
</div>
|
||||||
|
</body>
|
||||||
|
</html>
|
35
dotnet-template/content/Plugin.cs
Normal file
35
dotnet-template/content/Plugin.cs
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using Jellyfin.Plugin.dotnet_template.Configuration;
|
||||||
|
using MediaBrowser.Common.Configuration;
|
||||||
|
using MediaBrowser.Common.Plugins;
|
||||||
|
using MediaBrowser.Model.Plugins;
|
||||||
|
using MediaBrowser.Model.Serialization;
|
||||||
|
|
||||||
|
namespace Jellyfin.Plugin.dotnet_template
|
||||||
|
{
|
||||||
|
public class Plugin : BasePlugin<PluginConfiguration>,
|
||||||
|
IHasWebPages
|
||||||
|
{
|
||||||
|
public override string Name => "dotnet_template";
|
||||||
|
public override Guid Id => Guid.Parse("pluginguid");
|
||||||
|
public Plugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer) : base(applicationPaths, xmlSerializer)
|
||||||
|
{
|
||||||
|
Instance = this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Plugin Instance { get; private set; }
|
||||||
|
|
||||||
|
public IEnumerable<PluginPageInfo> GetPages()
|
||||||
|
{
|
||||||
|
return new[]
|
||||||
|
{
|
||||||
|
new PluginPageInfo
|
||||||
|
{
|
||||||
|
Name = this.Name,
|
||||||
|
EmbeddedResourcePath = string.Format("Jellyfin.Plugin.{0}.Configuration.configPage.html",this.Name)
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
21
dotnet-template/content/example-jellyfin-plugin.csproj
Normal file
21
dotnet-template/content/example-jellyfin-plugin.csproj
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
<RootNamespace>Jellyfin.Plugin.dotnet_template</RootNamespace>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="Jellyfin.Controller" Version="10.2.0.1" />
|
||||||
|
<PackageReference Include="Jellyfin.Model" Version="10.2.0.1" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<None Remove="Configuration\configPage.html" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<EmbeddedResource Include="Configuration\configPage.html" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
14
dotnet-template/example-jellyfin-plugin.nuspec
Normal file
14
dotnet-template/example-jellyfin-plugin.nuspec
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
|
||||||
|
<metadata>
|
||||||
|
<id>Jellyfin.Plugin</id>
|
||||||
|
<version>1.0.0</version>
|
||||||
|
<description>
|
||||||
|
A template to create a new Jellyfin plugin.
|
||||||
|
</description>
|
||||||
|
<authors>Jellyfin Team</authors>
|
||||||
|
<packageTypes>
|
||||||
|
<packageType name="Template" />
|
||||||
|
</packageTypes>
|
||||||
|
</metadata>
|
||||||
|
</package>
|
Loading…
x
Reference in New Issue
Block a user