IChannel.cs 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  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 home page URL.
  19. /// </summary>
  20. /// <value>The home page URL.</value>
  21. string HomePageUrl { get; }
  22. /// <summary>
  23. /// Gets the capabilities.
  24. /// </summary>
  25. /// <returns>ChannelCapabilities.</returns>
  26. ChannelCapabilities GetCapabilities();
  27. /// <summary>
  28. /// Determines whether [is enabled for] [the specified user].
  29. /// </summary>
  30. /// <param name="user">The user.</param>
  31. /// <returns><c>true</c> if [is enabled for] [the specified user]; otherwise, <c>false</c>.</returns>
  32. bool IsEnabledFor(User user);
  33. /// <summary>
  34. /// Searches the specified search term.
  35. /// </summary>
  36. /// <param name="searchInfo">The search information.</param>
  37. /// <param name="user">The user.</param>
  38. /// <param name="cancellationToken">The cancellation token.</param>
  39. /// <returns>Task{IEnumerable{ChannelItemInfo}}.</returns>
  40. Task<IEnumerable<ChannelItemInfo>> Search(ChannelSearchInfo searchInfo, User user, CancellationToken cancellationToken);
  41. /// <summary>
  42. /// Gets the channel items.
  43. /// </summary>
  44. /// <param name="query">The query.</param>
  45. /// <param name="cancellationToken">The cancellation token.</param>
  46. /// <returns>Task{IEnumerable{ChannelItem}}.</returns>
  47. Task<ChannelItemResult> GetChannelItems(InternalChannelItemQuery query, CancellationToken cancellationToken);
  48. /// <summary>
  49. /// Gets the channel image.
  50. /// </summary>
  51. /// <param name="type">The type.</param>
  52. /// <param name="cancellationToken">The cancellation token.</param>
  53. /// <returns>Task{DynamicImageInfo}.</returns>
  54. Task<DynamicImageResponse> GetChannelImage(ImageType type, CancellationToken cancellationToken);
  55. /// <summary>
  56. /// Gets the supported channel images.
  57. /// </summary>
  58. /// <returns>IEnumerable{ImageType}.</returns>
  59. IEnumerable<ImageType> GetSupportedChannelImages();
  60. }
  61. public class ChannelCapabilities
  62. {
  63. public bool CanSearch { get; set; }
  64. }
  65. public class ChannelSearchInfo
  66. {
  67. public string SearchTerm { get; set; }
  68. }
  69. public class InternalChannelItemQuery
  70. {
  71. public string CategoryId { get; set; }
  72. public User User { get; set; }
  73. }
  74. public class ChannelItemResult
  75. {
  76. public List<ChannelItemInfo> Items { get; set; }
  77. public TimeSpan CacheLength { get; set; }
  78. }
  79. }