Configuration page. Root folder hiding does not work.
Some checks failed
continuous-integration/drone/push Build is failing
Some checks failed
continuous-integration/drone/push Build is failing
This commit is contained in:
@@ -155,13 +155,13 @@ public abstract class CinemaFilterFolder : Folder
|
||||
folder = new T
|
||||
{
|
||||
Id = folderId,
|
||||
Name = localizedName,
|
||||
DateCreated = CinemaHost.FileSystem.GetCreationTimeUtc(folderPath),
|
||||
DateModified = CinemaHost.FileSystem.GetLastWriteTimeUtc(folderPath)
|
||||
};
|
||||
}
|
||||
|
||||
folder.Id = folderId;
|
||||
folder.Name = localizedName;
|
||||
folder.Path = folderPath;
|
||||
if (parent == null)
|
||||
{
|
||||
@@ -188,8 +188,6 @@ public abstract class CinemaFilterFolder : Folder
|
||||
return folder;
|
||||
}
|
||||
|
||||
|
||||
|
||||
internal static string GetInternalMetadataPath(string basePath, Guid id)
|
||||
{
|
||||
return System.IO.Path.Combine(basePath, "cinema", id.ToString("N", CultureInfo.InvariantCulture), "metadata");
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using Jellyfin.Plugin.Cinema.Configuration;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
using MediaBrowser.Model.IO;
|
||||
using MediaBrowser.Model.Plugins;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
@@ -13,7 +15,7 @@ namespace Jellyfin.Plugin.Cinema;
|
||||
public sealed class CinemaHost : IHostedService
|
||||
{
|
||||
#pragma warning disable CS8618
|
||||
// This instance is specially registered and gets created before all classes
|
||||
// This instance is specially registered and gets created before all classes
|
||||
// except CinemaServiceRegistrator and CinemaPlugin.
|
||||
private static ILibraryManager _libraryManager;
|
||||
private static IServerConfigurationManager _config;
|
||||
@@ -34,7 +36,7 @@ public sealed class CinemaHost : IHostedService
|
||||
|
||||
public static ILibraryManager LibraryManager => _libraryManager;
|
||||
|
||||
public static string InternalMetadataPath => _config.ApplicationPaths.InternalMetadataPath;
|
||||
public static string InternalMetadataPath => _config.ApplicationPaths.InternalMetadataPath;
|
||||
|
||||
public static IFileSystem FileSystem => _fileSystem;
|
||||
|
||||
@@ -45,22 +47,28 @@ public sealed class CinemaHost : IHostedService
|
||||
/// <inheritdoc />
|
||||
public Task StartAsync(CancellationToken cancellationToken)
|
||||
{
|
||||
// Make sure the Stream Cinema root folders are created
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaMoviesFolder>("Movies");
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaTvShowsFolder>("TV Shows");
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaAnimeFolder>("Anime");
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaConcertFolder>("Music");
|
||||
|
||||
/*
|
||||
pluginItems.Add(CreateMenuItem("movies", Resources.Movies, GetResourceUrl("movies.png")));
|
||||
pluginItems.Add(CreateMenuItem("shows", Resources.Shows, GetResourceUrl("tvshows.png")));
|
||||
pluginItems.Add(CreateMenuItem("tv", Resources.TvProgram, GetResourceUrl("tv-program.png")));
|
||||
pluginItems.Add(CreateMenuItem("anime", Resources.Anime, GetResourceUrl("anime.png")));
|
||||
pluginItems.Add(CreateMenuItem("concerts", Resources.Concerts, GetResourceUrl("music.png")));*/
|
||||
CinemaPlugin.Instance!.ConfigurationChanged += ReloadConfig;
|
||||
|
||||
EnsureRootFolders(CinemaPlugin.Instance!.Configuration);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task StopAsync(CancellationToken cancellationToken) => Task.CompletedTask;
|
||||
}
|
||||
|
||||
private void ReloadConfig(object? sender, BasePluginConfiguration e)
|
||||
{
|
||||
EnsureRootFolders((CinemaPluginConfiguration)e);
|
||||
}
|
||||
|
||||
private void EnsureRootFolders(CinemaPluginConfiguration config) {
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaMoviesFolder>(string.IsNullOrWhiteSpace(config.MoviesFolderName) ? "Movies" : config.MoviesFolderName)
|
||||
.Hide = config.HideMoviesFolder;
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaTvShowsFolder>(string.IsNullOrWhiteSpace(config.SeriesFolderName) ? "TV Shows" : config.SeriesFolderName)
|
||||
.Hide = config.HideSeriesFolder;
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaAnimeFolder>(string.IsNullOrWhiteSpace(config.AnimeFolderName) ? "Anime" : config.AnimeFolderName)
|
||||
.Hide = config.HideAnimeFolder;
|
||||
CinemaFilterFolder.CreateRootFilterFolder<CinemaConcertFolder>(string.IsNullOrWhiteSpace(config.MusicFolderName) ? "Music" : config.MusicFolderName)
|
||||
.Hide = config.HideMusicFolder;
|
||||
}
|
||||
}
|
||||
@@ -8,12 +8,17 @@
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\CinemaLib\CinemaLib.csproj" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.10.3" />
|
||||
<PackageReference Include="Jellyfin.Controller" Version="10.10.3" /-->
|
||||
<!--ProjectReference Include="..\..\..\jellyfin/MediaBrowser.Controller\MediaBrowser.Controller.csproj" /-->
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.10.3" />
|
||||
<PackageReference Include="Jellyfin.Model" Version="10.10.3" /-->
|
||||
<!--ProjectReference Include="..\..\..\jellyfin\MediaBrowser.Model\MediaBrowser.Model.csproj" /-->
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<None Remove="Configuration\config.html" />
|
||||
<EmbeddedResource Include="Configuration\config.html" />
|
||||
</ItemGroup>
|
||||
|
||||
<Target Name="PostBuild" AfterTargets="PostBuildEvent" Condition="'$(Configuration)' == 'Debug'">
|
||||
<ItemGroup>
|
||||
<DebugCopyFiles Include="$(TargetDir)\Cinema*.dll" />
|
||||
|
||||
@@ -20,6 +20,7 @@ public class CinemaPlugin : BasePlugin<CinemaPluginConfiguration>, IHasWebPages
|
||||
public CinemaPlugin(IApplicationPaths applicationPaths, IXmlSerializer xmlSerializer)
|
||||
: base(applicationPaths, xmlSerializer)
|
||||
{
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -31,6 +32,11 @@ public class CinemaPlugin : BasePlugin<CinemaPluginConfiguration>, IHasWebPages
|
||||
/// <inheritdoc />
|
||||
public override string Description => "Videodoplněk obsahující rozsáhlou databázi filmů a seriálů.";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the current plugin instance.
|
||||
/// </summary>
|
||||
public static CinemaPlugin? Instance { get; private set; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<PluginPageInfo> GetPages()
|
||||
{
|
||||
@@ -39,12 +45,7 @@ public class CinemaPlugin : BasePlugin<CinemaPluginConfiguration>, IHasWebPages
|
||||
new PluginPageInfo
|
||||
{
|
||||
Name = "cinema",
|
||||
EmbeddedResourcePath = GetType().Namespace + ".Web.cinema.html",
|
||||
},
|
||||
new PluginPageInfo
|
||||
{
|
||||
Name = "cinemajs",
|
||||
EmbeddedResourcePath = GetType().Namespace + ".Web.cinema.js"
|
||||
EmbeddedResourcePath = "CinemaJellyfin.Configuration.config.html",
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -25,7 +25,8 @@ public abstract class CinemaRootFolder : CinemaFilterFolder, ICollectionFolder
|
||||
/// </summary>
|
||||
public abstract CollectionType? CollectionType { get; }
|
||||
|
||||
|
||||
public override bool IsHidden => Hide;
|
||||
internal bool Hide { get; set; }
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -9,46 +9,20 @@ public class CinemaPluginConfiguration : BasePluginConfiguration
|
||||
{
|
||||
public CinemaPluginConfiguration()
|
||||
{
|
||||
Pin = "0000";
|
||||
WebServiceUrl = "http://localhost:8866";
|
||||
EnableDebugLogging = false;
|
||||
NewEpisodes = false;
|
||||
RecordingDefault = "2";
|
||||
RecordingTransport = 1;
|
||||
EnableInProgress = false;
|
||||
PollInterval = 20;
|
||||
BackendVersion = 0;
|
||||
}
|
||||
|
||||
public string WebServiceUrl { get; set; }
|
||||
public string MoviesFolderName { get; set; }
|
||||
public bool HideMoviesFolder { get; set; }
|
||||
|
||||
public string CurrentWebServiceURL { get; set; }
|
||||
public string SeriesFolderName { get; set; }
|
||||
public bool HideSeriesFolder { get; set; }
|
||||
|
||||
public int BackendVersion { get; set; }
|
||||
public string AnimeFolderName { get; set; }
|
||||
public bool HideAnimeFolder { get; set; }
|
||||
|
||||
public string Pin { get; set; }
|
||||
public string MusicFolderName { get; set; }
|
||||
public bool HideMusicFolder { get; set; }
|
||||
|
||||
public string StoredSid { get; set; }
|
||||
|
||||
public bool EnableDebugLogging { get; set; }
|
||||
|
||||
public bool EnableInProgress { get; set; }
|
||||
|
||||
public int PollInterval { get; set; }
|
||||
|
||||
public bool NewEpisodes { get; set; }
|
||||
|
||||
public bool ShowRepeat { get; set; }
|
||||
|
||||
public bool GetEpisodeImage { get; set; }
|
||||
|
||||
public string RecordingDefault { get; set; }
|
||||
|
||||
public int RecordingTransport { get; set; }
|
||||
|
||||
public int PrePaddingSeconds { get; set; }
|
||||
|
||||
public int PostPaddingSeconds { get; set; }
|
||||
|
||||
public DateTime RecordingModificationTime { get; set; }
|
||||
public string WebshareUser { get; set; }
|
||||
public string WebsharePassword { get; set; }
|
||||
}
|
||||
|
||||
158
CinemaJellyfin/Configuration/config.html
Normal file
158
CinemaJellyfin/Configuration/config.html
Normal file
@@ -0,0 +1,158 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>Cinema</title>
|
||||
</head>
|
||||
<body>
|
||||
<div id="configPage" data-role="page" class="page type-interior pluginConfigurationPage configPage" data-require="emby-input,emby-button,emby-checkbox">
|
||||
<div data-role="content">
|
||||
<div class="content-primary">
|
||||
<h1>Cinema</h1>
|
||||
<form class="configForm">
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" type="text" id="moviesFolderName" label="Movies Folder Name" />
|
||||
<div class="fieldDescription">Custom name for the Cinema Movies root folder.</div>
|
||||
</div>
|
||||
<label class="checkboxContainer">
|
||||
<input is="emby-checkbox" type="checkbox" id="hideMoviesFolder" />
|
||||
<span>Hide the Cinema Movies root folder.</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" type="text" id="seriesFolderName" label="TV Shows Folder Name" />
|
||||
<div class="fieldDescription">Custom name for the Cinema TV Shows root folder.</div>
|
||||
</div>
|
||||
<label class="checkboxContainer">
|
||||
<input is="emby-checkbox" type="checkbox" id="hideSeriesFolder" />
|
||||
<span>Hide the Cinema TV Shows root folder.</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" type="text" id="animeFolderName" label="Anime Folder Name" />
|
||||
<div class="fieldDescription">Custom name for the Cinema Anime root folder.</div>
|
||||
</div>
|
||||
<label class="checkboxContainer">
|
||||
<input is="emby-checkbox" type="checkbox" id="hideAnimeFolder" />
|
||||
<span>Hide the Cinema Anime root folder.</span>
|
||||
</label>
|
||||
<br />
|
||||
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" type="text" id="musicFolderName" label="Music Folder Name" />
|
||||
<div class="fieldDescription">Custom name for the Cinema Music root folder.</div>
|
||||
</div>
|
||||
<label class="checkboxContainer">
|
||||
<input is="emby-checkbox" type="checkbox" id="hideMusicFolder" />
|
||||
<span>Hide the Cinema Music root folder.</span>
|
||||
</label>
|
||||
<div class="verticalSection verticalSection-extrabottompadding">
|
||||
<h2>Webshare Account</h2>
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" type="text" id="webshareUser" label="Webshare user name" />
|
||||
<div class="fieldDescription">Webshare account to allow watching in better quality.</div>
|
||||
</div>
|
||||
|
||||
<div class="inputContainer">
|
||||
<input is="emby-input" type="password" id="websharePassword" label="Webshare password" />
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div>
|
||||
<button is="emby-button" type="submit" class="raised button-submit block"><span>Save</span></button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var CinemaPluginConfig = {
|
||||
uniquePluginId: "253cce3e-aa5f-11ef-bb75-8f5ab4b2eee3"
|
||||
};
|
||||
|
||||
document.querySelector('.configPage')
|
||||
.addEventListener('pageshow', function () {
|
||||
Dashboard.showLoadingMsg();
|
||||
ApiClient.getPluginConfiguration(CinemaPluginConfig.uniquePluginId).then(function (config) {
|
||||
var moviesFolderName = document.querySelector('#moviesFolderName');
|
||||
if (config.MoviesFolderName)
|
||||
moviesFolderName.value = config.MoviesFolderName;
|
||||
moviesFolderName.dispatchEvent(new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
document.querySelector('#hideMoviesFolder').checked = config.HideMoviesFolder;
|
||||
|
||||
var seriesFolderName = document.querySelector('#seriesFolderName');
|
||||
if (config.SeriesFolderName)
|
||||
seriesFolderName.value = config.SeriesFolderName;
|
||||
seriesFolderName.dispatchEvent(new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
document.querySelector('#hideSeriesFolder').checked = config.HideSeriesFolder;
|
||||
|
||||
var animeFolderName = document.querySelector('#animeFolderName');
|
||||
if (config.AnimeFolderName)
|
||||
animeFolderName.value = config.AnimeFolderName;
|
||||
animeFolderName.dispatchEvent(new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
document.querySelector('#hideAnimeFolder').checked = config.HideAnimeFolder;
|
||||
|
||||
var musicFolderName = document.querySelector('#musicFolderName');
|
||||
if (config.MusicFolderName)
|
||||
musicFolderName.value = config.MusicFolderName;
|
||||
musicFolderName.dispatchEvent(new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
document.querySelector('#hideMusicFolder').checked = config.HideMusicFolder;
|
||||
|
||||
var webshareUser = document.querySelector('#webshareUser');
|
||||
if (config.WebshareUser)
|
||||
webshareUser.value = config.WebshareUser;
|
||||
webshareUser.dispatchEvent(new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
var websharePassword = document.querySelector('#websharePassword');
|
||||
if (config.WebsharePassword)
|
||||
websharePassword.value = config.WebsharePassword;
|
||||
websharePassword.dispatchEvent(new Event('change', {
|
||||
bubbles: true,
|
||||
cancelable: false
|
||||
}));
|
||||
|
||||
Dashboard.hideLoadingMsg();
|
||||
});
|
||||
});
|
||||
|
||||
document.querySelector('.configForm')
|
||||
.addEventListener('submit', function (e) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
ApiClient.getPluginConfiguration(CinemaPluginConfig.uniquePluginId).then(function (config) {
|
||||
config.MoviesFolderName = document.querySelector('#moviesFolderName').value;
|
||||
config.HideMoviesFolder = document.querySelector('#hideMoviesFolder').checked;
|
||||
config.SeriesFolderName = document.querySelector('#seriesFolderName').value;
|
||||
config.HideSeriesFolder = document.querySelector('#hideSeriesFolder').checked;
|
||||
config.AnimeFolderName = document.querySelector('#animeFolderName').value;
|
||||
config.HideAnimeFolder = document.querySelector('#hideAnimeFolder').checked;
|
||||
config.MusicFolderName = document.querySelector('#musicFolderName').value;
|
||||
config.HideMusicFolder = document.querySelector('#hideMusicFolder').checked;
|
||||
|
||||
config.WebshareUser = document.querySelector('#webshareUser').value;
|
||||
config.WebsharePassword = document.querySelector('#websharePassword').value;
|
||||
|
||||
ApiClient.updatePluginConfiguration(CinemaPluginConfig.uniquePluginId, config).then(Dashboard.processPluginConfigurationUpdateResult);
|
||||
});
|
||||
|
||||
e.preventDefault();
|
||||
return false;
|
||||
});
|
||||
</script>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user