using MediaBrowser.Controller.Entities;
using MediaBrowser.Controller.Entities.Audio;
using MediaBrowser.Controller.Entities.TV;
using MediaBrowser.Controller.Providers;
using MediaBrowser.Controller.Resolvers;
using MediaBrowser.Controller.Sorting;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Querying;
using System;
using System.Collections.Generic;
using System.IO;
using System.Threading;
using System.Threading.Tasks;
using CommonIO;
using MediaBrowser.Common.IO;
namespace MediaBrowser.Controller.Library
{
///
/// Interface ILibraryManager
///
public interface ILibraryManager
{
///
/// Resolves the path.
///
/// The file information.
/// The parent.
/// BaseItem.
BaseItem ResolvePath(FileSystemMetadata fileInfo,
Folder parent = null);
///
/// Resolves a set of files into a list of BaseItem
///
/// The files.
/// The directory service.
/// The parent.
/// Type of the collection.
/// List{``0}.
IEnumerable ResolvePaths(IEnumerable files,
IDirectoryService directoryService,
Folder parent, string
collectionType = null);
///
/// Gets the root folder.
///
/// The root folder.
AggregateFolder RootFolder { get; }
///
/// Gets a Person
///
/// The name.
/// Task{Person}.
Person GetPerson(string name);
///
/// Finds the by path.
///
/// The path.
/// BaseItem.
BaseItem FindByPath(string path);
///
/// Gets the artist.
///
/// The name.
/// Task{Artist}.
MusicArtist GetArtist(string name);
///
/// Gets the album artists.
///
/// The items.
/// IEnumerable<MusicArtist>.
IEnumerable GetAlbumArtists(IEnumerable items);
///
/// Gets the artists.
///
/// The items.
/// IEnumerable<MusicArtist>.
IEnumerable GetArtists(IEnumerable items);
///
/// Gets a Studio
///
/// The name.
/// Task{Studio}.
Studio GetStudio(string name);
///
/// Gets a Genre
///
/// The name.
/// Task{Genre}.
Genre GetGenre(string name);
///
/// Gets the genre.
///
/// The name.
/// Task{MusicGenre}.
MusicGenre GetMusicGenre(string name);
///
/// Gets the game genre.
///
/// The name.
/// Task{GameGenre}.
GameGenre GetGameGenre(string name);
///
/// Gets a Year
///
/// The value.
/// Task{Year}.
///
Year GetYear(int value);
///
/// 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.
///
/// The cancellation token.
/// The progress.
/// Task.
Task ValidatePeople(CancellationToken cancellationToken, IProgress progress);
///
/// Reloads the root media folder
///
/// The progress.
/// The cancellation token.
/// Task.
Task ValidateMediaLibrary(IProgress progress, CancellationToken cancellationToken);
///
/// Queues the library scan.
///
void QueueLibraryScan();
///
/// Gets the default view.
///
/// IEnumerable{VirtualFolderInfo}.
IEnumerable GetVirtualFolders();
///
/// Gets the item by id.
///
/// The id.
/// BaseItem.
BaseItem GetItemById(Guid id);
///
/// Gets the memory item by identifier.
///
/// The identifier.
/// BaseItem.
BaseItem GetMemoryItemById(Guid id);
///
/// Gets the intros.
///
/// The item.
/// The user.
/// IEnumerable{System.String}.
Task> GetIntros(BaseItem item, User user);
///
/// Gets all intro files.
///
/// IEnumerable{System.String}.
IEnumerable GetAllIntroFiles();
///
/// Adds the parts.
///
/// The rules.
/// The plugin folders.
/// The resolvers.
/// The intro providers.
/// The item comparers.
/// The postscan tasks.
void AddParts(IEnumerable rules,
IEnumerable pluginFolders,
IEnumerable resolvers,
IEnumerable introProviders,
IEnumerable itemComparers,
IEnumerable postscanTasks);
///
/// Sorts the specified items.
///
/// The items.
/// The user.
/// The sort by.
/// The sort order.
/// IEnumerable{BaseItem}.
IEnumerable Sort(IEnumerable items, User user, IEnumerable sortBy,
SortOrder sortOrder);
///
/// Ensure supplied item has only one instance throughout
///
/// The item.
/// The proper instance to the item
BaseItem GetOrAddByReferenceItem(BaseItem item);
///
/// Gets the user root folder.
///
/// UserRootFolder.
Folder GetUserRootFolder();
///
/// Creates the item.
///
/// The item.
/// The cancellation token.
/// Task.
Task CreateItem(BaseItem item, CancellationToken cancellationToken);
///
/// Creates the items.
///
/// The items.
/// The cancellation token.
/// Task.
Task CreateItems(IEnumerable items, CancellationToken cancellationToken);
///
/// Updates the item.
///
/// The item.
/// The update reason.
/// The cancellation token.
/// Task.
Task UpdateItem(BaseItem item, ItemUpdateType updateReason, CancellationToken cancellationToken);
///
/// Retrieves the item.
///
/// The id.
/// BaseItem.
BaseItem RetrieveItem(Guid id);
///
/// Occurs when [item added].
///
event EventHandler ItemAdded;
///
/// Occurs when [item updated].
///
event EventHandler ItemUpdated;
///
/// Occurs when [item removed].
///
event EventHandler ItemRemoved;
///
/// Reports the item removed.
///
/// The item.
void ReportItemRemoved(BaseItem item);
///
/// Finds the type of the collection.
///
/// The item.
/// System.String.
string GetContentType(BaseItem item);
///
/// Gets the type of the inherited content.
///
/// The item.
/// System.String.
string GetInheritedContentType(BaseItem item);
///
/// Gets the type of the configured content.
///
/// The item.
/// System.String.
string GetConfiguredContentType(BaseItem item);
///
/// Gets the type of the configured content.
///
/// The path.
/// System.String.
string GetConfiguredContentType(string path);
///
/// Normalizes the root path list.
///
/// The paths.
/// IEnumerable{System.String}.
IEnumerable NormalizeRootPathList(IEnumerable paths);
///
/// Registers the item.
///
/// The item.
void RegisterItem(BaseItem item);
///
/// Deletes the item.
///
/// The item.
/// The options.
/// Task.
Task DeleteItem(BaseItem item, DeleteOptions options);
///
/// Replaces the videos with primary versions.
///
/// The items.
/// IEnumerable{BaseItem}.
IEnumerable ReplaceVideosWithPrimaryVersions(IEnumerable items);
///
/// Gets the named view.
///
/// The user.
/// The name.
/// The parent identifier.
/// Type of the view.
/// Name of the sort.
/// The cancellation token.
/// Task<UserView>.
Task GetNamedView(User user,
string name,
string parentId,
string viewType,
string sortName,
CancellationToken cancellationToken);
///
/// Gets the named view.
///
/// The user.
/// The name.
/// Type of the view.
/// Name of the sort.
/// The cancellation token.
/// Task<UserView>.
Task GetNamedView(User user,
string name,
string viewType,
string sortName,
CancellationToken cancellationToken);
///
/// Gets the named view.
///
/// The name.
/// Type of the view.
/// Name of the sort.
/// The cancellation token.
/// Task<UserView>.
Task GetNamedView(string name,
string viewType,
string sortName,
CancellationToken cancellationToken);
///
/// Gets the named view.
///
/// The name.
/// The parent identifier.
/// Type of the view.
/// Name of the sort.
/// The unique identifier.
/// The cancellation token.
/// Task<UserView>.
Task GetNamedView(string name,
string parentId,
string viewType,
string sortName,
string uniqueId,
CancellationToken cancellationToken);
///
/// Gets the shadow view.
///
/// The parent.
/// Type of the view.
/// Name of the sort.
/// The cancellation token.
/// Task<UserView>.
Task GetShadowView(BaseItem parent,
string viewType,
string sortName,
CancellationToken cancellationToken);
///
/// Determines whether [is video file] [the specified path].
///
/// The path.
/// true if [is video file] [the specified path]; otherwise, false.
bool IsVideoFile(string path);
///
/// Determines whether [is audio file] [the specified path].
///
/// The path.
/// true if [is audio file] [the specified path]; otherwise, false.
bool IsAudioFile(string path);
///
/// Gets the season number from path.
///
/// The path.
/// System.Nullable<System.Int32>.
int? GetSeasonNumberFromPath(string path);
///
/// Fills the missing episode numbers from path.
///
/// The episode.
/// true if XXXX, false otherwise.
bool FillMissingEpisodeNumbersFromPath(Episode episode);
///
/// Parses the name.
///
/// The name.
/// ItemInfo.
ItemLookupInfo ParseName(string name);
///
/// Gets the new item identifier.
///
/// The key.
/// The type.
/// Guid.
Guid GetNewItemId(string key, Type type);
///
/// Finds the trailers.
///
/// The owner.
/// The file system children.
/// The directory service.
/// IEnumerable<Trailer>.
IEnumerable