using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Providers; using MediaBrowser.Model.Entities; using System; using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; namespace MediaBrowser.Controller.Channels { public interface IChannel { /// /// Gets the name. /// /// The name. string Name { get; } /// /// Gets the channel information. /// /// ChannelInfo. ChannelInfo GetChannelInfo(); /// /// Determines whether [is enabled for] [the specified user]. /// /// The user. /// true if [is enabled for] [the specified user]; otherwise, false. bool IsEnabledFor(User user); /// /// Searches the specified search term. /// /// The search information. /// The user. /// The cancellation token. /// Task{IEnumerable{ChannelItemInfo}}. Task> Search(ChannelSearchInfo searchInfo, User user, CancellationToken cancellationToken); /// /// Gets the channel items. /// /// The query. /// The cancellation token. /// Task{IEnumerable{ChannelItem}}. Task GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken); /// /// Gets the channel image. /// /// The type. /// The cancellation token. /// Task{DynamicImageInfo}. Task GetChannelImage(ImageType type, CancellationToken cancellationToken); /// /// Gets the supported channel images. /// /// IEnumerable{ImageType}. IEnumerable GetSupportedChannelImages(); } public interface IChannelFactory { IEnumerable GetChannels(); } public class ChannelInfo { /// /// Gets the home page URL. /// /// The home page URL. public string HomePageUrl { get; set; } /// /// Gets or sets a value indicating whether this instance can search. /// /// true if this instance can search; otherwise, false. public bool CanSearch { get; set; } public List MediaTypes { get; set; } public List ContentTypes { get; set; } public ChannelInfo() { MediaTypes = new List(); ContentTypes = new List(); } } public class ChannelSearchInfo { public string SearchTerm { get; set; } } public class InternalChannelItemQuery { public string CategoryId { get; set; } public User User { get; set; } } public class ChannelItemResult { public List Items { get; set; } public TimeSpan CacheLength { get; set; } } }