mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-18 20:24:20 +01:00
support grouping behind boxsets
This commit is contained in:
@@ -126,6 +126,18 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
ItemType = item.GetType().Name,
|
||||
Type = LinkedChildType.Manual
|
||||
});
|
||||
|
||||
var supportsGrouping = item as ISupportsBoxSetGrouping;
|
||||
|
||||
if (supportsGrouping != null)
|
||||
{
|
||||
var boxsetIdList = supportsGrouping.BoxSetIdList.ToList();
|
||||
if (!boxsetIdList.Contains(collectionId))
|
||||
{
|
||||
boxsetIdList.Add(collectionId);
|
||||
}
|
||||
supportsGrouping.BoxSetIdList = boxsetIdList;
|
||||
}
|
||||
}
|
||||
|
||||
collection.LinkedChildren.AddRange(list);
|
||||
@@ -156,6 +168,16 @@ namespace MediaBrowser.Server.Implementations.Collections
|
||||
}
|
||||
|
||||
list.Add(child);
|
||||
|
||||
var childItem = _libraryManager.GetItemById(itemId);
|
||||
var supportsGrouping = childItem as ISupportsBoxSetGrouping;
|
||||
|
||||
if (supportsGrouping != null)
|
||||
{
|
||||
var boxsetIdList = supportsGrouping.BoxSetIdList.ToList();
|
||||
boxsetIdList.Remove(collectionId);
|
||||
supportsGrouping.BoxSetIdList = boxsetIdList;
|
||||
}
|
||||
}
|
||||
|
||||
var shortcutFiles = Directory
|
||||
|
||||
@@ -0,0 +1,50 @@
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.Movies;
|
||||
using MediaBrowser.Controller.Library;
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||
{
|
||||
public class BoxSetPostScanTask : ILibraryPostScanTask
|
||||
{
|
||||
private readonly ILibraryManager _libraryManager;
|
||||
|
||||
public BoxSetPostScanTask(ILibraryManager libraryManager)
|
||||
{
|
||||
_libraryManager = libraryManager;
|
||||
}
|
||||
|
||||
public Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||
{
|
||||
var items = _libraryManager.RootFolder.RecursiveChildren.ToList();
|
||||
|
||||
var boxsets = items.OfType<BoxSet>().ToList();
|
||||
|
||||
var numComplete = 0;
|
||||
|
||||
foreach (var boxset in boxsets)
|
||||
{
|
||||
foreach (var child in boxset.GetLinkedChildren().OfType<ISupportsBoxSetGrouping>())
|
||||
{
|
||||
var boxsetIdList = child.BoxSetIdList.ToList();
|
||||
if (!boxsetIdList.Contains(boxset.Id))
|
||||
{
|
||||
boxsetIdList.Add(boxset.Id);
|
||||
}
|
||||
child.BoxSetIdList = boxsetIdList;
|
||||
}
|
||||
|
||||
numComplete++;
|
||||
double percent = numComplete;
|
||||
percent /= boxsets.Count;
|
||||
progress.Report(percent * 100);
|
||||
}
|
||||
|
||||
progress.Report(100);
|
||||
return Task.FromResult(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -165,6 +165,7 @@
|
||||
<Compile Include="Library\UserManager.cs" />
|
||||
<Compile Include="Library\Validators\ArtistsPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\ArtistsValidator.cs" />
|
||||
<Compile Include="Library\Validators\BoxSetPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\CountHelpers.cs" />
|
||||
<Compile Include="Library\Validators\GameGenresPostScanTask.cs" />
|
||||
<Compile Include="Library\Validators\GameGenresValidator.cs" />
|
||||
|
||||
Reference in New Issue
Block a user