Skip to content

Commit

Permalink
fixes #5 config saving, bump assembly
Browse files Browse the repository at this point in the history
  • Loading branch information
PrplHaz4 committed Oct 17, 2019
1 parent 3af34aa commit 410e72d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 64 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class PluginConfiguration : BasePluginConfiguration
/// <summary>
/// Initializes a new instance of the <see cref="PluginConfiguration" /> class.
/// </summary>
public PluginConfiguration() : base()
public PluginConfiguration()
{
ServerIP = "localhost";
ServerPort = 9080;
Expand Down
82 changes: 21 additions & 61 deletions Jellyfin.Plugin.ServerWMC/Configuration/configPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,12 @@
<title>ServerWMC</title>
</head>
<body>
<div data-role="page" class="page type-interior pluginConfigurationPage serverwmcConfigurationPage">

<div id="ServerWMCConfigurationPage" data-role="page" class="page type-interior pluginConfigurationPage" data-require="emby-input,emby-button">
<div data-role="content">
<div class="content-primary">
<form class="serverwmcConfigurationForm">

<ul class="ulForm" data-role="listview">
<li>
<a href="http://bit.ly/serverwmc" target="_blank">
ServerWMC app is required for this plugin, download installer here
</a>
<p class="fieldDescription">
The ServerWMC app needs to be running on the machine that has WMC installed and configured, but the WMC app does not need to be running to use the program.
</p>
<p class="fieldDescription">
If Jellyfin Server is running on a different machine than ServerWMC, make sure that the 'Recorded TV' folder that is used for new recordings is shared on the network (see 'Folders' tab in ServerWMC), and make sure the Jellyfin Server can access this folder.
</p>
</li>
<li>
<label for="txtServerWMCIP">
ServerWMC IP/Name:
</label>
<input type="text" id="txtServerWMCIP" name="txtServerWMCIP" />
<div class="fieldDescription">
The ip address or name of your ServerWMC machine
<form id="ServerWMCConfigurationForm">
</div>
</li>
<li>
Expand Down Expand Up @@ -60,49 +41,28 @@
</div>

<script type="text/javascript">

var ServerWMCConfigurationPage = {
pluginUniqueId: "1fc322a1-af2e-49a5-b2eb-a89b4240f700"
var ServerWMCConfig = {
pluginUniqueId: '1fc322a1-af2e-49a5-b2eb-a89b4240f700'
};

$('.serverwmcConfigurationPage').on('pageshow', function (event) {

Dashboard.showLoadingMsg();

var page = this;

ApiClient.getPluginConfiguration(ServerWMCConfigurationPage.pluginUniqueId).then(function (config) {

$('#txtServerWMCIP', page).val(config.ServerIP || "");
$('#txtServerWMCPort', page).val(config.ServerPort || "");
$('#txtLinuxPath', page).val(config.LinuxPath || "");
$('#txtMaxEpgDownload', page).val(config.EpgMaxDownload || "");

Dashboard.hideLoadingMsg();
$('#ServerWMCConfigurationPage').on('pageshow', function () {
ApiClient.getPluginConfiguration(ServerWMCConfig.pluginUniqueId).then(function (config) {
var page = $.mobile.activePage;
$('#txtServerWMCIP', page).val(config.ServerIP).change();
$('#txtServerWMCPort', page).val(config.ServerPort).change();
$('#txtLinuxPath', page).val(config.LinuxPath).change();
});
});

$('.serverwmcConfigurationPage').on('submit', function (e) {

Dashboard.showLoadingMsg();

var form = this;

ApiClient.getPluginConfiguration(ServerWMCConfigurationPage.pluginUniqueId).then(function (config) {

var serverIP = $('#txtServerWMCIP', form).val();
var serverPort = $('#txtServerWMCPort', form).val();
var linuxPath = $('#txtLinuxPath', form).val();
var maxEpgDownload = $('#txtMaxEpgDownload', form).val();

config.ServerIP = serverIP ? serverIP : null;
config.ServerPort = serverPort ? serverPort : null;
config.LinuxPath = linuxPath ? linuxPath : null;
config.EpgMaxDownload = maxEpgDownload ? maxEpgDownload : null;

ApiClient.updatePluginConfiguration(ServerWMCConfigurationPage.pluginUniqueId, config).then(Dashboard.processPluginConfigurationUpdateResult,
function () {
alert('There was an error communicating with ServerWmc. Please make sure the ServerWmc application is installed and running, and reachable from the above configured address.');
$('#ServerWMCConfigurationForm').on('submit', function () {
ApiClient.getPluginConfiguration(ServerWMCConfig.pluginUniqueId).then(function (config) {
var page = $.mobile.activePage;
config.ServerIP = $('#txtServerWMCIP', page).val();
config.ServerPort = $('#txtServerWMCPort', page).val();
config.LinuxPath = $('#txtLinuxPath', page).val();
ApiClient.updatePluginConfiguration(ServerWMCConfig.pluginUniqueId, config).then(function (result) {
Dashboard.processPluginConfigurationUpdateResult(result);
},
function (result) {
Dashboard.alert("Saving configuration failed.");
});
});

Expand Down
4 changes: 2 additions & 2 deletions Jellyfin.Plugin.ServerWMC/Jellyfin.Plugin.ServerWMC.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<RootNamespace>Jellyfin.Plugin.ServerWMC</RootNamespace>
<AssemblyVersion>1.0.0</AssemblyVersion>
<FileVersion>1.0.0</FileVersion>
<AssemblyVersion>2.0.0</AssemblyVersion>
<FileVersion>2.0.0</FileVersion>
</PropertyGroup>

<ItemGroup>
Expand Down

0 comments on commit 410e72d

Please sign in to comment.