IChannel.cs 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Controller.Providers;
  3. using MediaBrowser.Model.Entities;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Threading;
  7. using System.Threading.Tasks;
  8. namespace MediaBrowser.Controller.Channels
  9. {
  10. public interface IChannel
  11. {
  12. /// <summary>
  13. /// Gets the name.
  14. /// </summary>
  15. /// <value>The name.</value>
  16. string Name { get; }
  17. /// <summary>
  18. /// Gets the channel information.
  19. /// </summary>
  20. /// <returns>ChannelInfo.</returns>
  21. ChannelInfo GetChannelInfo();
  22. /// <summary>
  23. /// Determines whether [is enabled for] [the specified user].
  24. /// </summary>
  25. /// <param name="user">The user.</param>
  26. /// <returns><c>true</c> if [is enabled for] [the specified user]; otherwise, <c>false</c>.</returns>
  27. bool IsEnabledFor(User user);
  28. /// <summary>
  29. /// Searches the specified search term.
  30. /// </summary>
  31. /// <param name="searchInfo">The search information.</param>
  32. /// <param name="user">The user.</param>
  33. /// <param name="cancellationToken">The cancellation token.</param>
  34. /// <returns>Task{IEnumerable{ChannelItemInfo}}.</returns>
  35. Task<IEnumerable<ChannelItemInfo>> Search(ChannelSearchInfo searchInfo, User user, CancellationToken cancellationToken);
  36. /// <summary>
  37. /// Gets the channel items.
  38. /// </summary>
  39. /// <param name="query">The query.</param>
  40. /// <param name="cancellationToken">The cancellation token.</param>
  41. /// <returns>Task{IEnumerable{ChannelItem}}.</returns>
  42. Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken);
  43. /// <summary>
  44. /// Gets the channel image.
  45. /// </summary>
  46. /// <param name="type">The type.</param>
  47. /// <param name="cancellationToken">The cancellation token.</param>
  48. /// <returns>Task{DynamicImageInfo}.</returns>
  49. Task<DynamicImageResponse> GetChannelImage(ImageType type, CancellationToken cancellationToken);
  50. /// <summary>
  51. /// Gets the supported channel images.
  52. /// </summary>
  53. /// <returns>IEnumerable{ImageType}.</returns>
  54. IEnumerable<ImageType> GetSupportedChannelImages();
  55. }
  56. public interface IChannelFactory
  57. {
  58. IEnumerable<IChannel> GetChannels();
  59. }
  60. public class ChannelSearchInfo
  61. {
  62. public string SearchTerm { get; set; }
  63. }
  64. public class InternalChannelItemQuery
  65. {
  66. public string CategoryId { get; set; }
  67. public User User { get; set; }
  68. }
  69. public class ChannelItemResult
  70. {
  71. public List<ChannelItemInfo> Items { get; set; }
  72. public TimeSpan CacheLength { get; set; }
  73. }
  74. }