jellyfin/MediaBrowser.Controller/Library/ILibraryManager.cs

409 lines
15 KiB
C#
Raw Normal View History

using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
2014-02-12 22:11:54 -07:00
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
2013-03-09 21:22:36 -07:00
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Entities;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
namespace MediaBrowser.Controller.Library
{
/// <summary>
/// Interface ILibraryManager
/// </summary>
public interface ILibraryManager
{
2014-02-12 22:11:54 -07:00
/// <summary>
/// Resolves the path.
/// </summary>
/// <param name="fileInfo">The file information.</param>
/// <param name="parent">The parent.</param>
2014-10-22 21:26:01 -07:00
/// <param name="collectionType">Type of the collection.</param>
2014-02-12 22:11:54 -07:00
/// <returns>BaseItem.</returns>
2014-10-22 21:26:01 -07:00
BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null, string collectionType = null);
/// <summary>
/// Resolves a set of files into a list of BaseItem
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="files">The files.</param>
2014-02-12 22:11:54 -07:00
/// <param name="directoryService">The directory service.</param>
/// <param name="parent">The parent.</param>
2014-10-22 21:26:01 -07:00
/// <param name="collectionType">Type of the collection.</param>
/// <returns>List{``0}.</returns>
2014-10-22 21:26:01 -07:00
List<T> ResolvePaths<T>(IEnumerable<FileSystemInfo> files, IDirectoryService directoryService, Folder parent, string collectionType = null)
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>
/// <returns>Task{Person}.</returns>
Person GetPerson(string name);
/// <summary>
/// Gets the artist.
/// </summary>
/// <param name="name">The name.</param>
/// <returns>Task{Artist}.</returns>
2013-11-21 13:48:26 -07:00
MusicArtist GetArtist(string name);
/// <summary>
/// Gets a Studio
/// </summary>
/// <param name="name">The name.</param>
/// <returns>Task{Studio}.</returns>
Studio GetStudio(string name);
/// <summary>
/// Gets a Genre
/// </summary>
/// <param name="name">The name.</param>
/// <returns>Task{Genre}.</returns>
Genre GetGenre(string name);
2013-06-10 20:31:00 -07:00
/// <summary>
/// Gets the genre.
/// </summary>
/// <param name="name">The name.</param>
/// <returns>Task{MusicGenre}.</returns>
MusicGenre GetMusicGenre(string name);
2013-07-01 10:17:33 -07:00
/// <summary>
/// Gets the game genre.
/// </summary>
/// <param name="name">The name.</param>
/// <returns>Task{GameGenre}.</returns>
GameGenre GetGameGenre(string name);
/// <summary>
/// Gets a Year
/// </summary>
/// <param name="value">The value.</param>
/// <returns>Task{Year}.</returns>
/// <exception cref="System.ArgumentOutOfRangeException"></exception>
Year GetYear(int value);
/// <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>
/// Queues the library scan.
/// </summary>
void QueueLibraryScan();
/// <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);
2014-10-22 21:26:01 -07:00
/// <summary>
/// Gets the memory item by identifier.
/// </summary>
/// <param name="id">The identifier.</param>
/// <returns>BaseItem.</returns>
BaseItem GetMemoryItemById(Guid id);
/// <summary>
/// Gets the intros.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="user">The user.</param>
/// <returns>IEnumerable{System.String}.</returns>
2014-09-22 14:56:54 -07:00
Task<IEnumerable<Video>> GetIntros(BaseItem item, User user);
/// <summary>
/// Gets all intro files.
/// </summary>
/// <returns>IEnumerable{System.String}.</returns>
IEnumerable<string> GetAllIntroFiles();
/// <summary>
/// Adds the parts.
/// </summary>
/// <param name="rules">The rules.</param>
/// <param name="pluginFolders">The plugin folders.</param>
/// <param name="resolvers">The resolvers.</param>
/// <param name="introProviders">The intro providers.</param>
2013-03-09 21:22:36 -07:00
/// <param name="itemComparers">The item comparers.</param>
/// <param name="postscanTasks">The postscan tasks.</param>
void AddParts(IEnumerable<IResolverIgnoreRule> rules,
IEnumerable<IVirtualFolderCreator> pluginFolders,
IEnumerable<IItemResolver> resolvers,
IEnumerable<IIntroProvider> introProviders,
IEnumerable<IBaseItemComparer> itemComparers,
IEnumerable<ILibraryPostScanTask> postscanTasks);
2013-03-09 21:22:36 -07: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-11 21:26:23 -07:00
/// <summary>
/// Ensure supplied item has only one instance throughout
/// </summary>
/// <param name="item">The item.</param>
/// <returns>The proper instance to the item</returns>
BaseItem GetOrAddByReferenceItem(BaseItem item);
/// <summary>
/// Gets the user root folder.
/// </summary>
/// <returns>UserRootFolder.</returns>
2014-02-20 22:04:11 -07:00
Folder GetUserRootFolder();
/// <summary>
/// Creates the item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task CreateItem(BaseItem item, CancellationToken cancellationToken);
2013-05-23 08:39:48 -07: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);
/// <summary>
/// Updates the item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="updateReason">The update reason.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken);
/// <summary>
/// Retrieves the item.
/// </summary>
/// <param name="id">The id.</param>
2013-06-17 13:35:43 -07:00
/// <returns>BaseItem.</returns>
2013-06-26 09:08:16 -07:00
BaseItem RetrieveItem(Guid id);
2013-04-21 21:38:03 -07: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);
/// <summary>
/// Validates the music genres.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
Task ValidateMusicGenres(CancellationToken cancellationToken, IProgress<double> progress);
/// <summary>
/// Validates the game genres.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
Task ValidateGameGenres(CancellationToken cancellationToken, IProgress<double> progress);
/// <summary>
/// Validates the genres.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
Task ValidateGenres(CancellationToken cancellationToken, IProgress<double> progress);
/// <summary>
/// Validates the studios.
/// </summary>
/// <param name="cancellationToken">The cancellation token.</param>
/// <param name="progress">The progress.</param>
/// <returns>Task.</returns>
Task ValidateStudios(CancellationToken cancellationToken, IProgress<double> progress);
/// <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 12:56:40 -07:00
/// <summary>
/// Finds the type of the collection.
/// </summary>
/// <param name="item">The item.</param>
/// <returns>System.String.</returns>
string FindCollectionType(BaseItem item);
2013-11-13 09:45:41 -07:00
2013-11-21 13:48:26 -07:00
/// <summary>
/// Normalizes the root path list.
/// </summary>
/// <param name="paths">The paths.</param>
/// <returns>IEnumerable{System.String}.</returns>
IEnumerable<string> NormalizeRootPathList(IEnumerable<string> paths);
2014-01-10 22:49:18 -07:00
/// <summary>
/// Registers the item.
/// </summary>
/// <param name="item">The item.</param>
void RegisterItem(BaseItem item);
2014-02-19 11:50:37 -07:00
/// <summary>
/// Deletes the item.
/// </summary>
/// <param name="item">The item.</param>
/// <param name="options">The options.</param>
2014-02-19 11:50:37 -07:00
/// <returns>Task.</returns>
Task DeleteItem(BaseItem item, DeleteOptions options);
2014-03-18 21:59:45 -07:00
/// <summary>
/// Replaces the videos with primary versions.
/// </summary>
/// <param name="items">The items.</param>
/// <returns>IEnumerable{BaseItem}.</returns>
IEnumerable<BaseItem> ReplaceVideosWithPrimaryVersions(IEnumerable<BaseItem> items);
2014-06-07 12:46:24 -07:00
/// <summary>
2014-10-29 15:01:02 -07:00
/// Gets the special folder.
2014-06-07 12:46:24 -07:00
/// </summary>
2014-10-29 15:01:02 -07:00
/// <param name="user">The user.</param>
2014-06-07 12:46:24 -07:00
/// <param name="name">The name.</param>
2014-10-29 15:01:02 -07:00
/// <param name="parentId">The parent identifier.</param>
2014-06-17 22:16:00 -07:00
/// <param name="viewType">Type of the view.</param>
2014-06-07 12:46:24 -07:00
/// <param name="sortName">Name of the sort.</param>
/// <param name="cancellationToken">The cancellation token.</param>
2014-10-29 15:01:02 -07:00
/// <returns>Task&lt;UserView&gt;.</returns>
Task<UserView> GetSpecialFolder(User user,
string name,
string parentId,
string viewType,
string sortName,
CancellationToken cancellationToken);
2014-09-04 20:48:53 -07:00
/// <summary>
/// Gets the named view.
/// </summary>
/// <param name="name">The name.</param>
/// <param name="viewType">Type of the view.</param>
/// <param name="sortName">Name of the sort.</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task&lt;UserView&gt;.</returns>
2014-10-29 15:01:02 -07:00
Task<UserView> GetNamedView(string name,
string viewType,
string sortName,
CancellationToken cancellationToken);
2014-11-16 13:44:08 -07:00
/// <summary>
/// Determines whether [is video file] [the specified path].
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [is video file] [the specified path]; otherwise, <c>false</c>.</returns>
bool IsVideoFile(string path);
bool IsAudioFile(string path);
/// <summary>
/// Determines whether [is multi part file] [the specified path].
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [is multi part file] [the specified path]; otherwise, <c>false</c>.</returns>
bool IsMultiPartFile(string path);
/// <summary>
/// Determines whether [is multi part folder] [the specified path].
/// </summary>
/// <param name="path">The path.</param>
/// <returns><c>true</c> if [is multi part folder] [the specified path]; otherwise, <c>false</c>.</returns>
bool IsMultiPartFolder(string path);
/// <summary>
/// Gets the season number from path.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
int? GetSeasonNumberFromPath(string path);
/// <summary>
/// Gets the season number from episode file.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
int? GetSeasonNumberFromEpisodeFile(string path);
/// <summary>
/// Gets the ending episode number from file.
/// </summary>
/// <param name="path">The path.</param>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
int? GetEndingEpisodeNumberFromFile(string path);
/// <summary>
/// Gets the episode number from file.
/// </summary>
/// <param name="path">The path.</param>
/// <param name="considerSeasonless">if set to <c>true</c> [consider seasonless].</param>
/// <returns>System.Nullable&lt;System.Int32&gt;.</returns>
int? GetEpisodeNumberFromFile(string path, bool considerSeasonless);
}
}