mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-06-04 06:48:35 +01:00
Manage some items as single instance throughout #54
This commit is contained in:
@@ -24,7 +24,11 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// </summary>
|
||||
public abstract class BaseItem : IHasProviderIds
|
||||
{
|
||||
/// <summary>
|
||||
private Guid _testId = Guid.NewGuid();
|
||||
public Guid TestId
|
||||
{
|
||||
get { return _testId; }
|
||||
} /// <summary>
|
||||
/// The trailer folder name
|
||||
/// </summary>
|
||||
public const string TrailerFolderName = "trailers";
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using System;
|
||||
using MediaBrowser.Model.Entities;
|
||||
|
||||
namespace MediaBrowser.Controller.Entities
|
||||
{
|
||||
@@ -7,7 +8,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// Plugins derive from and export this class to create a folder that will appear in the root along
|
||||
/// with all the other actual physical folders in the system.
|
||||
/// </summary>
|
||||
public abstract class BasePluginFolder : Folder, ICollectionFolder
|
||||
public abstract class BasePluginFolder : Folder, ICollectionFolder, IByReferenceItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the id.
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Tasks;
|
||||
using System;
|
||||
using System.Collections.Concurrent;
|
||||
@@ -15,7 +16,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// Specialized Folder class that points to a subset of the physical folders in the system.
|
||||
/// It is created from the user-specific folders within the system root
|
||||
/// </summary>
|
||||
public class CollectionFolder : Folder, ICollectionFolder
|
||||
public class CollectionFolder : Folder, ICollectionFolder, IByReferenceItem
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets a value indicating whether this instance is virtual folder.
|
||||
|
||||
@@ -811,7 +811,7 @@ namespace MediaBrowser.Controller.Entities
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
protected virtual IEnumerable<BaseItem> GetCachedChildren()
|
||||
{
|
||||
return Kernel.Instance.ItemRepository.RetrieveChildren(this);
|
||||
return Kernel.Instance.ItemRepository.RetrieveChildren(this).Select(i => i is IByReferenceItem ? LibraryManager.GetOrAddByReferenceItem(i) : i);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -181,5 +181,12 @@ namespace MediaBrowser.Controller.Library
|
||||
/// <param name="searchTerm">The search term.</param>
|
||||
/// <returns>IEnumerable{BaseItem}.</returns>
|
||||
IEnumerable<BaseItem> Search(IEnumerable<BaseItem> items, string searchTerm);
|
||||
|
||||
/// <summary>
|
||||
/// Ensure supplied item has only one instance throughout
|
||||
/// </summary>
|
||||
/// <param name="item"></param>
|
||||
/// <returns>The proper instance to the item</returns>
|
||||
BaseItem GetOrAddByReferenceItem(BaseItem item);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user