LiveTvChannel.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Model.Dto;
  3. using MediaBrowser.Model.LiveTv;
  4. using System.Collections.Generic;
  5. using System.Runtime.Serialization;
  6. namespace MediaBrowser.Controller.LiveTv
  7. {
  8. public class LiveTvChannel : BaseItem, IItemByName
  9. {
  10. public LiveTvChannel()
  11. {
  12. UserItemCountList = new List<ItemByNameCounts>();
  13. }
  14. /// <summary>
  15. /// Gets the user data key.
  16. /// </summary>
  17. /// <returns>System.String.</returns>
  18. public override string GetUserDataKey()
  19. {
  20. return GetClientTypeName() + "-" + Name;
  21. }
  22. [IgnoreDataMember]
  23. public List<ItemByNameCounts> UserItemCountList { get; set; }
  24. /// <summary>
  25. /// Gets or sets the number.
  26. /// </summary>
  27. /// <value>The number.</value>
  28. public string Number { get; set; }
  29. /// <summary>
  30. /// Gets or sets the external identifier.
  31. /// </summary>
  32. /// <value>The external identifier.</value>
  33. public string ExternalId { get; set; }
  34. /// <summary>
  35. /// Gets or sets the type of the channel.
  36. /// </summary>
  37. /// <value>The type of the channel.</value>
  38. public ChannelType ChannelType { get; set; }
  39. public string ServiceName { get; set; }
  40. /// <summary>
  41. /// Supply the image path if it can be accessed directly from the file system
  42. /// </summary>
  43. /// <value>The image path.</value>
  44. public string ProviderImagePath { get; set; }
  45. /// <summary>
  46. /// Supply the image url if it can be downloaded
  47. /// </summary>
  48. /// <value>The image URL.</value>
  49. public string ProviderImageUrl { get; set; }
  50. /// <summary>
  51. /// Gets or sets a value indicating whether this instance has image.
  52. /// </summary>
  53. /// <value><c>null</c> if [has image] contains no value, <c>true</c> if [has image]; otherwise, <c>false</c>.</value>
  54. public bool? HasProviderImage { get; set; }
  55. protected override string CreateSortName()
  56. {
  57. double number = 0;
  58. if (!string.IsNullOrEmpty(Number))
  59. {
  60. double.TryParse(Number, out number);
  61. }
  62. return number.ToString("000-") + (Name ?? string.Empty);
  63. }
  64. public override string MediaType
  65. {
  66. get
  67. {
  68. return ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video;
  69. }
  70. }
  71. public override string GetClientTypeName()
  72. {
  73. return "Channel";
  74. }
  75. }
  76. }