Skip to content

Commit

Permalink
add colletion filter by scene type
Browse files Browse the repository at this point in the history
  • Loading branch information
DirtyRacer1337 committed Nov 6, 2024
1 parent 4036063 commit 78d04e1
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 0 deletions.
12 changes: 12 additions & 0 deletions Jellyfin.Plugin.ThePornDB/Configuration/PluginConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,14 @@ public enum TagStyle
Disabled = 2,
}

public enum CollectionType
{
Scene = 0,
Movie = 1,
JAV = 2,
All = 3,
}

public enum StudioStyle
{
Site = 0,
Expand Down Expand Up @@ -74,6 +82,8 @@ public PluginConfiguration()

this.CollectionMinSize = 0;
this.AddCollectionToCollections = true;
this.CollectionType = CollectionType.All;

this.StudioStyle = StudioStyle.All;

this.UseCustomTitle = false;
Expand Down Expand Up @@ -113,6 +123,8 @@ public PluginConfiguration()

public bool AddCollectionToCollections { get; set; }

public CollectionType CollectionType { get; set; }

public StudioStyle StudioStyle { get; set; }

public bool UseCustomTitle { get; set; }
Expand Down
11 changes: 11 additions & 0 deletions Jellyfin.Plugin.ThePornDB/Configuration/configPage.html
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,15 @@ <h1>ThePornDB</h1>
<span>Add Collection to Collections</span>
</label>
</div>
<div class="selectContainer">
<label class="selectLabel" for="CollectionType">Collection Type</label>
<select is="emby-select" id="CollectionType" name="CollectionType" class="emby-select-withcolor emby-select">
<option value="All">All</option>
<option value="Scene">Scene</option>
<option value="Movie">Movie</option>
<option value="JAV">JAV</option>
</select>
</div>
<div class="selectContainer">
<label class="selectLabel" for="StudioStyle">Studio Style</label>
<select is="emby-select" id="StudioStyle" name="StudioStyle" class="emby-select-withcolor emby-select">
Expand Down Expand Up @@ -154,6 +163,7 @@ <h1>ThePornDB</h1>
$('#AddCollectionOnSite').prop('checked', config.AddCollectionOnSite);
$('#CollectionMinSize').val(config.CollectionMinSize).change();
$('#AddCollectionToCollections').prop('checked', config.AddCollectionToCollections);
$('#CollectionType').val(config.CollectionType).change();
$('#StudioStyle').val(config.StudioStyle).change();
$('#UseCustomTitle').prop('checked', config.UseCustomTitle);
$('#CustomTitle').val(config.CustomTitle).change();
Expand Down Expand Up @@ -181,6 +191,7 @@ <h1>ThePornDB</h1>
config.AddCollectionOnSite = $('#AddCollectionOnSite').prop('checked');
config.CollectionMinSize = $('#CollectionMinSize').val();
config.AddCollectionToCollections = $('#AddCollectionToCollections').prop('checked');
config.CollectionType = $('#CollectionType').val();
config.StudioStyle = $('#StudioStyle').val();
config.UseCustomTitle = $('#UseCustomTitle').prop('checked');
config.CustomTitle = $('#CustomTitle').val();
Expand Down
8 changes: 8 additions & 0 deletions Jellyfin.Plugin.ThePornDB/ScheduledTasks/AddCollection.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@
using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Library;
using MediaBrowser.Model.Tasks;
using ThePornDB.Configuration;
using ThePornDB.Helpers;
using ThePornDB.Providers;

#if __EMBY__
#else
Expand Down Expand Up @@ -45,6 +48,11 @@ public async Task ExecuteAsync(IProgress<double> progress, CancellationToken can
progress?.Report(0);

var items = this.libraryManager.GetItemList(new InternalItemsQuery()).Where(o => o.ProviderIds.ContainsKey(Plugin.Instance.Name));
if (Plugin.Instance.Configuration.CollectionType != CollectionType.All)
{
var (prefixID, _, _) = Base.GetSettings((SceneType)Plugin.Instance.Configuration.CollectionType);
items = items.Where(o => o.ProviderIds[Plugin.Instance.Name].StartsWith(prefixID, StringComparison.OrdinalIgnoreCase));
}

if (Plugin.Instance.Configuration.UseUnmatchedTag)
{
Expand Down

0 comments on commit 78d04e1

Please sign in to comment.