mirror of
https://github.com/metatube-community/jellyfin-plugin-metatube.git
synced 2026-07-11 16:05:38 +08:00
Add collection support
This commit is contained in:
@@ -18,6 +18,12 @@ public enum TranslationEngine
|
||||
|
||||
public class PluginConfiguration : BasePluginConfiguration
|
||||
{
|
||||
#region Collection
|
||||
|
||||
public bool EnableCollection { get; set; } = false;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Rating
|
||||
|
||||
public bool EnableRating { get; set; } = true;
|
||||
|
||||
@@ -35,6 +35,13 @@
|
||||
<div class="fieldDescription">Access Token of JavTube Server.</div>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescripton">
|
||||
<label class="emby-checkbox-label">
|
||||
<input id="chkEnableCollection" is="emby-checkbox" name="chkEnableCollection" type="checkbox"/>
|
||||
<span>Enable Collection</span>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="checkboxContainer checkboxContainer-withDescripton">
|
||||
<label class="emby-checkbox-label">
|
||||
<input id="chkEnableRating" is="emby-checkbox" name="chkEnableRating" type="checkbox"/>
|
||||
@@ -143,6 +150,7 @@
|
||||
ApiClient.getPluginConfiguration(JavTubePluginConfig.pluginUniqueId).then(function (config) {
|
||||
$('#txtServer', page).val(config.Server).change();
|
||||
$('#txtToken', page).val(config.Token).change();
|
||||
page.querySelector('#chkEnableCollection').checked = config.EnableCollection;
|
||||
page.querySelector('#chkEnableRating').checked = config.EnableRating;
|
||||
page.querySelector('#chkEnableTrailer').checked = config.EnableTrailer;
|
||||
$('#sltTranslationMode', page).val(config.TranslationMode).change();
|
||||
@@ -161,6 +169,7 @@
|
||||
ApiClient.getPluginConfiguration(JavTubePluginConfig.pluginUniqueId).then(function (config) {
|
||||
config.Server = $('#txtServer', form).val();
|
||||
config.Token = $('#txtToken', form).val();
|
||||
config.EnableCollection = $('#chkEnableCollection').prop('checked');
|
||||
config.EnableRating = $('#chkEnableRating').prop('checked');
|
||||
config.EnableTrailer = $('#chkEnableTrailer').prop('checked');
|
||||
config.TranslationMode = $('#sltTranslationMode', form).val();
|
||||
|
||||
@@ -1,12 +1,24 @@
|
||||
#if !__EMBY__
|
||||
#pragma warning disable CA2254
|
||||
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Jellyfin.Plugin.JavTube.Extensions;
|
||||
|
||||
internal static class LoggerExtensions
|
||||
internal static class JellyfinExtensions
|
||||
{
|
||||
#region MovieExtensions
|
||||
|
||||
public static void AddCollection(this Movie movie, string name)
|
||||
{
|
||||
movie.CollectionName = name;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region LoggerExtensions
|
||||
|
||||
public static void Debug(this ILogger logger, string message, params object[] args)
|
||||
{
|
||||
logger.LogDebug(message, args);
|
||||
@@ -26,6 +38,8 @@ internal static class LoggerExtensions
|
||||
{
|
||||
logger.LogError(message, args);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
#pragma warning restore CA2254
|
||||
@@ -91,6 +91,9 @@ public class MovieProvider : BaseProvider, IRemoteMetadataProvider<Movie, MovieI
|
||||
if (Configuration.EnableRating)
|
||||
result.Item.CommunityRating = m.Score > 0 ? (float)Math.Round(m.Score * 2, 1) : null;
|
||||
|
||||
if (Configuration.EnableCollection && !string.IsNullOrWhiteSpace(m.Series))
|
||||
result.Item.AddCollection(m.Series);
|
||||
|
||||
// Add Studio.
|
||||
if (!string.IsNullOrWhiteSpace(m.Maker))
|
||||
result.Item.AddStudio(m.Maker);
|
||||
|
||||
Reference in New Issue
Block a user