2013-05-03 04:10:11 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities;
|
2013-04-21 01:02:16 +00:00
|
|
|
|
using MediaBrowser.Controller.Entities.Audio;
|
2013-03-03 16:53:58 +00:00
|
|
|
|
using MediaBrowser.Controller.Resolvers;
|
2013-03-10 04:22:36 +00:00
|
|
|
|
using MediaBrowser.Controller.Sorting;
|
2013-02-28 19:32:41 +00:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
2013-03-02 02:44:46 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2013-05-03 04:10:11 +00:00
|
|
|
|
using System.IO;
|
2013-03-02 02:44:46 +00:00
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
2013-02-28 19:32:41 +00:00
|
|
|
|
|
|
|
|
|
namespace MediaBrowser.Controller.Library
|
|
|
|
|
{
|
2013-05-21 03:16:43 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interface ILibraryManager
|
|
|
|
|
/// </summary>
|
2013-02-28 19:32:41 +00:00
|
|
|
|
public interface ILibraryManager
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="args">The args.</param>
|
|
|
|
|
/// <returns>BaseItem.</returns>
|
|
|
|
|
BaseItem ResolveItem(ItemResolveArgs args);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves a path into a BaseItem
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="fileInfo">The file info.</param>
|
2013-06-11 20:35:54 +00:00
|
|
|
|
/// <param name="parent">The parent.</param>
|
2013-02-28 19:32:41 +00:00
|
|
|
|
/// <returns>BaseItem.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentNullException"></exception>
|
2013-06-11 20:35:54 +00:00
|
|
|
|
BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null);
|
2013-02-28 19:32:41 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Resolves a set of files into a list of BaseItem
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <typeparam name="T"></typeparam>
|
|
|
|
|
/// <param name="files">The files.</param>
|
|
|
|
|
/// <param name="parent">The parent.</param>
|
|
|
|
|
/// <returns>List{``0}.</returns>
|
2013-04-28 05:29:27 +00:00
|
|
|
|
List<T> ResolvePaths<T>(IEnumerable<FileSystemInfo> files, Folder parent)
|
2013-02-28 19:32:41 +00:00
|
|
|
|
where T : BaseItem;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the root folder.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The root folder.</value>
|
|
|
|
|
AggregateFolder RootFolder { get; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a Person
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
|
|
|
|
/// <returns>Task{Person}.</returns>
|
|
|
|
|
Task<Person> GetPerson(string name, bool allowSlowProviders = false);
|
|
|
|
|
|
2013-04-21 01:02:16 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the artist.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
|
|
|
|
/// <returns>Task{Artist}.</returns>
|
|
|
|
|
Task<Artist> GetArtist(string name, bool allowSlowProviders = false);
|
|
|
|
|
|
2013-02-28 19:32:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a Studio
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
|
|
|
|
/// <returns>Task{Studio}.</returns>
|
|
|
|
|
Task<Studio> GetStudio(string name, bool allowSlowProviders = false);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a Genre
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
|
|
|
|
/// <returns>Task{Genre}.</returns>
|
|
|
|
|
Task<Genre> GetGenre(string name, bool allowSlowProviders = false);
|
|
|
|
|
|
2013-06-11 03:31:00 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the genre.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
|
|
|
|
/// <returns>Task{MusicGenre}.</returns>
|
|
|
|
|
Task<MusicGenre> GetMusicGenre(string name, bool allowSlowProviders = false);
|
2013-07-01 17:17:33 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the game genre.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="name">The name.</param>
|
|
|
|
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
|
|
|
|
/// <returns>Task{GameGenre}.</returns>
|
|
|
|
|
Task<GameGenre> GetGameGenre(string name, bool allowSlowProviders = false);
|
2013-06-11 03:31:00 +00:00
|
|
|
|
|
2013-02-28 19:32:41 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets a Year
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="value">The value.</param>
|
|
|
|
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
|
|
|
|
/// <returns>Task{Year}.</returns>
|
|
|
|
|
/// <exception cref="System.ArgumentOutOfRangeException"></exception>
|
|
|
|
|
Task<Year> GetYear(int value, bool allowSlowProviders = false);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Validate and refresh the People sub-set of the IBN.
|
|
|
|
|
/// The items are stored in the db but not loaded into memory until actually requested by an operation.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <param name="progress">The progress.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task ValidatePeople(CancellationToken cancellationToken, IProgress<double> progress);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reloads the root media folder
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="progress">The progress.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task ValidateMediaLibrary(IProgress<double> progress, CancellationToken cancellationToken);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the default view.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <returns>IEnumerable{VirtualFolderInfo}.</returns>
|
|
|
|
|
IEnumerable<VirtualFolderInfo> GetDefaultVirtualFolders();
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the view.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <returns>IEnumerable{VirtualFolderInfo}.</returns>
|
|
|
|
|
IEnumerable<VirtualFolderInfo> GetVirtualFolders(User user);
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the item by id.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">The id.</param>
|
|
|
|
|
/// <returns>BaseItem.</returns>
|
|
|
|
|
BaseItem GetItemById(Guid id);
|
|
|
|
|
|
2013-03-02 02:44:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the intros.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <returns>IEnumerable{System.String}.</returns>
|
|
|
|
|
IEnumerable<string> GetIntros(BaseItem item, User user);
|
|
|
|
|
|
2013-03-01 21:22:34 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Adds the parts.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="rules">The rules.</param>
|
|
|
|
|
/// <param name="pluginFolders">The plugin folders.</param>
|
|
|
|
|
/// <param name="resolvers">The resolvers.</param>
|
2013-03-02 02:44:46 +00:00
|
|
|
|
/// <param name="introProviders">The intro providers.</param>
|
2013-03-10 04:22:36 +00:00
|
|
|
|
/// <param name="itemComparers">The item comparers.</param>
|
2013-05-21 03:16:43 +00:00
|
|
|
|
/// <param name="prescanTasks">The prescan tasks.</param>
|
2013-05-27 16:53:10 +00:00
|
|
|
|
/// <param name="postscanTasks">The postscan tasks.</param>
|
2013-06-25 01:22:21 +00:00
|
|
|
|
/// <param name="savers">The savers.</param>
|
2013-04-08 15:55:53 +00:00
|
|
|
|
void AddParts(IEnumerable<IResolverIgnoreRule> rules,
|
|
|
|
|
IEnumerable<IVirtualFolderCreator> pluginFolders,
|
|
|
|
|
IEnumerable<IItemResolver> resolvers,
|
|
|
|
|
IEnumerable<IIntroProvider> introProviders,
|
2013-05-21 03:16:43 +00:00
|
|
|
|
IEnumerable<IBaseItemComparer> itemComparers,
|
2013-05-27 16:53:10 +00:00
|
|
|
|
IEnumerable<ILibraryPrescanTask> prescanTasks,
|
2013-06-25 01:22:21 +00:00
|
|
|
|
IEnumerable<ILibraryPostScanTask> postscanTasks,
|
|
|
|
|
IEnumerable<IMetadataSaver> savers);
|
2013-03-10 04:22:36 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Sorts the specified items.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">The items.</param>
|
|
|
|
|
/// <param name="user">The user.</param>
|
|
|
|
|
/// <param name="sortBy">The sort by.</param>
|
|
|
|
|
/// <param name="sortOrder">The sort order.</param>
|
|
|
|
|
/// <returns>IEnumerable{BaseItem}.</returns>
|
|
|
|
|
IEnumerable<BaseItem> Sort(IEnumerable<BaseItem> items, User user, IEnumerable<string> sortBy,
|
|
|
|
|
SortOrder sortOrder);
|
2013-03-12 04:26:23 +00:00
|
|
|
|
|
2013-03-15 19:08:49 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Ensure supplied item has only one instance throughout
|
|
|
|
|
/// </summary>
|
2013-05-21 03:16:43 +00:00
|
|
|
|
/// <param name="item">The item.</param>
|
2013-03-15 19:08:49 +00:00
|
|
|
|
/// <returns>The proper instance to the item</returns>
|
|
|
|
|
BaseItem GetOrAddByReferenceItem(BaseItem item);
|
2013-04-05 04:12:35 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets the user root folder.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="userRootPath">The user root path.</param>
|
|
|
|
|
/// <returns>UserRootFolder.</returns>
|
|
|
|
|
UserRootFolder GetUserRootFolder(string userRootPath);
|
2013-04-08 15:55:53 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
2013-05-03 04:10:11 +00:00
|
|
|
|
/// Creates the item.
|
2013-04-08 15:55:53 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2013-05-03 04:10:11 +00:00
|
|
|
|
Task CreateItem(BaseItem item, CancellationToken cancellationToken);
|
2013-04-08 15:55:53 +00:00
|
|
|
|
|
2013-05-23 15:39:48 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Creates the items.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="items">The items.</param>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task CreateItems(IEnumerable<BaseItem> items, CancellationToken cancellationToken);
|
|
|
|
|
|
2013-05-03 04:10:11 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Updates the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
2013-06-25 01:22:21 +00:00
|
|
|
|
/// <param name="updateReason">The update reason.</param>
|
2013-05-03 04:10:11 +00:00
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
2013-06-25 01:22:21 +00:00
|
|
|
|
Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken);
|
2013-05-21 03:16:43 +00:00
|
|
|
|
|
2013-04-08 15:55:53 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Retrieves the item.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="id">The id.</param>
|
2013-06-17 20:35:43 +00:00
|
|
|
|
/// <returns>BaseItem.</returns>
|
2013-06-26 16:08:16 +00:00
|
|
|
|
BaseItem RetrieveItem(Guid id);
|
2013-04-22 04:38:03 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Validates the artists.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="cancellationToken">The cancellation token.</param>
|
|
|
|
|
/// <param name="progress">The progress.</param>
|
|
|
|
|
/// <returns>Task.</returns>
|
|
|
|
|
Task ValidateArtists(CancellationToken cancellationToken, IProgress<double> progress);
|
2013-05-03 04:10:11 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [item added].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<ItemChangeEventArgs> ItemAdded;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [item updated].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<ItemChangeEventArgs> ItemUpdated;
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Occurs when [item removed].
|
|
|
|
|
/// </summary>
|
|
|
|
|
event EventHandler<ItemChangeEventArgs> ItemRemoved;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reports the item removed.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
void ReportItemRemoved(BaseItem item);
|
2013-07-12 19:56:40 +00:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Finds the type of the collection.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="item">The item.</param>
|
|
|
|
|
/// <returns>System.String.</returns>
|
|
|
|
|
string FindCollectionType(BaseItem item);
|
2013-02-28 19:32:41 +00:00
|
|
|
|
}
|
|
|
|
|
}
|