using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; using Jellyfin.Data.Entities; using Jellyfin.Data.Enums; using MediaBrowser.Controller.Entities; using MediaBrowser.Model.MediaSegments; namespace MediaBrowser.Controller; /// /// Defines methods for interacting with media segments. /// public interface IMediaSegmentManager { /// /// Uses all segment providers enabled for the 's library to get the Media Segments. /// /// The Item to evaluate. /// If set, will remove existing segments and replace it with new ones otherwise will check for existing segments and if found any, stops. /// stop request token. /// A task that indicates the Operation is finished. Task RunSegmentPluginProviders(BaseItem baseItem, bool overwrite, CancellationToken cancellationToken); /// /// Returns if this item supports media segments. /// /// The base Item to check. /// True if supported otherwise false. bool IsTypeSupported(BaseItem baseItem); /// /// Creates a new Media Segment associated with an Item. /// /// The segment to create. /// The id of the Provider who created this segment. /// The created Segment entity. Task CreateSegmentAsync(MediaSegmentDto mediaSegment, string segmentProviderId); /// /// Deletes a single media segment. /// /// The to delete. /// a task. Task DeleteSegmentAsync(Guid segmentId); /// /// Obtains all segments accociated with the itemId. /// /// The id of the . /// filteres all media segments of the given type to be included. If null all types are included. /// An enumerator of 's. Task> GetSegmentsAsync(Guid itemId, IEnumerable? typeFilter); /// /// Gets information about any media segments stored for the given itemId. /// /// The id of the . /// True if there are any segments stored for the item, otherwise false. /// TODO: this should be async but as the only caller BaseItem.GetVersionInfo isn't async, this is also not. Venson. bool HasSegments(Guid itemId); /// /// Gets a list of all registered Segment Providers and their IDs. /// /// The media item that should be tested for providers. /// A list of all providers for the tested item. IEnumerable<(string Name, string Id)> GetSupportedProviders(BaseItem item); }