#nullable disable #pragma warning disable CA1002, CS1591 using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Jellyfin.Data.Entities; using Jellyfin.Data.Enums; using MediaBrowser.Controller.Dto; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Entities.Audio; using MediaBrowser.Controller.Providers; using MediaBrowser.Controller.Resolvers; using MediaBrowser.Controller.Sorting; using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Dto; using MediaBrowser.Model.Entities; using MediaBrowser.Model.IO; using MediaBrowser.Model.Querying; using Episode = MediaBrowser.Controller.Entities.TV.Episode; using Genre = MediaBrowser.Controller.Entities.Genre; using Person = MediaBrowser.Controller.Entities.Person; namespace MediaBrowser.Controller.Library { /// /// Interface ILibraryManager. /// public interface ILibraryManager { /// /// Occurs when [item added]. /// event EventHandler ItemAdded; /// /// Occurs when [item updated]. /// event EventHandler ItemUpdated; /// /// Occurs when [item removed]. /// event EventHandler ItemRemoved; /// /// Gets the root folder. /// /// The root folder. AggregateFolder RootFolder { get; } bool IsScanRunning { get; } /// /// Resolves the path. /// /// The file information. /// The parent. /// An instance of . /// BaseItem. BaseItem ResolvePath( FileSystemMetadata fileInfo, Folder parent = null, IDirectoryService directoryService = null); /// /// Resolves a set of files into a list of BaseItem. /// /// The list of tiles. /// Instance of the interface. /// The parent folder. /// The library options. /// The collection type. /// The items resolved from the paths. IEnumerable ResolvePaths( IEnumerable files, IDirectoryService directoryService, Folder parent, LibraryOptions libraryOptions, CollectionType? collectionType = null); /// /// Gets a Person. /// /// The name of the person. /// Task{Person}. Person GetPerson(string name); /// /// Finds the by path. /// /// The path. /// true is the path is a directory; otherwise false. /// BaseItem. BaseItem FindByPath(string path, bool? isFolder); /// /// Gets the artist. /// /// The name of the artist. /// Task{Artist}. MusicArtist GetArtist(string name); MusicArtist GetArtist(string name, DtoOptions options); /// /// Gets a Studio. /// /// The name of the studio. /// Task{Studio}. Studio GetStudio(string name); /// /// Gets a Genre. /// /// The name of the genre. /// Task{Genre}. Genre GetGenre(string name); /// /// Gets the genre. /// /// The name of the music genre. /// Task{MusicGenre}. MusicGenre GetMusicGenre(string name); /// /// Gets a Year. /// /// The value. /// Task{Year}. /// Throws if year is invalid. 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 progress. /// The cancellation token. /// Task. Task ValidatePeopleAsync(IProgress progress, CancellationToken cancellationToken); /// /// Reloads the root media folder. /// /// The progress. /// The cancellation token. /// Task. Task ValidateMediaLibrary(IProgress progress, CancellationToken cancellationToken); Task UpdateImagesAsync(BaseItem item, bool forceUpdate = false); /// /// Gets the default view. /// /// IEnumerable{VirtualFolderInfo}. List GetVirtualFolders(); List GetVirtualFolders(bool includeRefreshState); /// /// Gets the item by id. /// /// The id. /// BaseItem. BaseItem GetItemById(Guid id); /// /// Gets the item by id, as T. /// /// The item id. /// The type of item. /// The item. T GetItemById(Guid id) where T : BaseItem; /// /// Gets the intros. /// /// The item. /// The user. /// IEnumerable{System.String}. Task> GetIntros(BaseItem item, User user); /// /// Adds the parts. /// /// The rules. /// The resolvers. /// The intro providers. /// The item comparers. /// The postscan tasks. void AddParts( IEnumerable rules, 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); IEnumerable Sort(IEnumerable items, User user, IEnumerable<(ItemSortBy OrderBy, SortOrder SortOrder)> orderBy); /// /// Gets the user root folder. /// /// UserRootFolder. Folder GetUserRootFolder(); /// /// Creates the item. /// /// Item to create. /// Parent of new item. void CreateItem(BaseItem item, BaseItem parent); /// /// Creates the items. /// /// Items to create. /// Parent of new items. /// CancellationToken to use for operation. void CreateItems(IReadOnlyList items, BaseItem parent, CancellationToken cancellationToken); /// /// Updates the item. /// /// Items to update. /// Parent of updated items. /// Reason for update. /// CancellationToken to use for operation. /// Returns a Task that can be awaited. Task UpdateItemsAsync(IReadOnlyList items, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken); /// /// Updates the item. /// /// The item. /// The parent item. /// The update reason. /// The cancellation token. /// Returns a Task that can be awaited. Task UpdateItemAsync(BaseItem item, BaseItem parent, ItemUpdateType updateReason, CancellationToken cancellationToken); /// /// Retrieves the item. /// /// The id. /// BaseItem. BaseItem RetrieveItem(Guid id); /// /// Finds the type of the collection. /// /// The item. /// System.String. CollectionType? GetContentType(BaseItem item); /// /// Gets the type of the inherited content. /// /// The item. /// System.String. CollectionType? GetInheritedContentType(BaseItem item); /// /// Gets the type of the configured content. /// /// The item. /// System.String. CollectionType? GetConfiguredContentType(BaseItem item); /// /// Gets the type of the configured content. /// /// The path. /// System.String. CollectionType? GetConfiguredContentType(string path); /// /// Normalizes the root path list. /// /// The paths. /// IEnumerable{System.String}. List NormalizeRootPathList(IEnumerable paths); /// /// Registers the item. /// /// The item. void RegisterItem(BaseItem item); /// /// Deletes the item. /// /// Item to delete. /// Options to use for deletion. void DeleteItem(BaseItem item, DeleteOptions options); /// /// Deletes the item. /// /// Item to delete. /// Options to use for deletion. /// Notify parent of deletion. void DeleteItem(BaseItem item, DeleteOptions options, bool notifyParentItem); /// /// Deletes the item. /// /// Item to delete. /// Options to use for deletion. /// Parent of item. /// Notify parent of deletion. void DeleteItem(BaseItem item, DeleteOptions options, BaseItem parent, bool notifyParentItem); /// /// Gets the named view. /// /// The user. /// The name. /// The parent identifier. /// Type of the view. /// Name of the sort. /// The named view. UserView GetNamedView( User user, string name, Guid parentId, CollectionType? viewType, string sortName); /// /// Gets the named view. /// /// The user. /// The name. /// Type of the view. /// Name of the sort. /// The named view. UserView GetNamedView( User user, string name, CollectionType? viewType, string sortName); /// /// Gets the named view. /// /// The name. /// Type of the view. /// Name of the sort. /// The named view. UserView GetNamedView( string name, CollectionType viewType, string sortName); /// /// Gets the named view. /// /// The name. /// The parent identifier. /// Type of the view. /// Name of the sort. /// The unique identifier. /// The named view. UserView GetNamedView( string name, Guid parentId, CollectionType? viewType, string sortName, string uniqueId); /// /// Gets the shadow view. /// /// The parent. /// Type of the view. /// Name of the sort. /// The shadow view. UserView GetShadowView( BaseItem parent, CollectionType? viewType, string sortName); /// /// Gets the season number from path. /// /// The path. /// System.Nullable<System.Int32>. int? GetSeasonNumberFromPath(string path); /// /// Fills the missing episode numbers from path. /// /// Episode to use. /// Option to force refresh of episode numbers. /// True if successful. bool FillMissingEpisodeNumbersFromPath(Episode episode, bool forceRefresh); /// /// 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 extras. /// /// The owner. /// The file system children. /// An instance of . /// IEnumerable<BaseItem>. IEnumerable FindExtras(BaseItem owner, IReadOnlyList fileSystemChildren, IDirectoryService directoryService); /// /// Gets the collection folders. /// /// The item. /// The folders that contain the item. List GetCollectionFolders(BaseItem item); /// /// Gets the collection folders. /// /// The item. /// The root folders to consider. /// The folders that contain the item. List GetCollectionFolders(BaseItem item, IEnumerable allUserRootChildren); LibraryOptions GetLibraryOptions(BaseItem item); /// /// Gets the people. /// /// The item. /// List<PersonInfo>. List GetPeople(BaseItem item); /// /// Gets the people. /// /// The query. /// List<PersonInfo>. List GetPeople(InternalPeopleQuery query); /// /// Gets the people items. /// /// The query. /// List<Person>. List GetPeopleItems(InternalPeopleQuery query); /// /// Updates the people. /// /// The item. /// The people. void UpdatePeople(BaseItem item, List people); /// /// Asynchronously updates the people. /// /// The item. /// The people. /// The cancellation token. /// The async task. Task UpdatePeopleAsync(BaseItem item, List people, CancellationToken cancellationToken); /// /// Gets the item ids. /// /// The query. /// List<Guid>. List GetItemIds(InternalItemsQuery query); /// /// Gets the people names. /// /// The query. /// List<System.String>. List GetPeopleNames(InternalPeopleQuery query); /// /// Queries the items. /// /// The query. /// QueryResult<BaseItem>. QueryResult QueryItems(InternalItemsQuery query); string GetPathAfterNetworkSubstitution(string path, BaseItem ownerItem = null); /// /// Converts the image to local. /// /// The item. /// The image. /// Index of the image. /// Task. Task ConvertImageToLocal(BaseItem item, ItemImageInfo image, int imageIndex); /// /// Gets the items. /// /// The query. /// QueryResult<BaseItem>. List GetItemList(InternalItemsQuery query); List GetItemList(InternalItemsQuery query, bool allowExternalContent); /// /// Gets the items. /// /// The query to use. /// Items to use for query. /// List of items. List GetItemList(InternalItemsQuery query, List parents); /// /// Gets the items result. /// /// The query. /// QueryResult<BaseItem>. QueryResult GetItemsResult(InternalItemsQuery query); /// /// Ignores the file. /// /// The file. /// The parent. /// true if XXXX, false otherwise. bool IgnoreFile(FileSystemMetadata file, BaseItem parent); Guid GetStudioId(string name); Guid GetGenreId(string name); Guid GetMusicGenreId(string name); Task AddVirtualFolder(string name, CollectionTypeOptions? collectionType, LibraryOptions options, bool refreshLibrary); Task RemoveVirtualFolder(string name, bool refreshLibrary); void AddMediaPath(string virtualFolderName, MediaPathInfo mediaPath); void UpdateMediaPath(string virtualFolderName, MediaPathInfo mediaPath); void RemoveMediaPath(string virtualFolderName, string mediaPath); QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetGenres(InternalItemsQuery query); QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetMusicGenres(InternalItemsQuery query); QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetStudios(InternalItemsQuery query); QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetArtists(InternalItemsQuery query); QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAlbumArtists(InternalItemsQuery query); QueryResult<(BaseItem Item, ItemCounts ItemCounts)> GetAllArtists(InternalItemsQuery query); int GetCount(InternalItemsQuery query); Task RunMetadataSavers(BaseItem item, ItemUpdateType updateReason); BaseItem GetParentItem(Guid? parentId, Guid? userId); /// /// Queue a library scan. /// /// /// This exists so plugins can trigger a library scan. /// void QueueLibraryScan(); } }