Channel.cs 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Model.Dto;
  3. using MediaBrowser.Model.LiveTv;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.Runtime.Serialization;
  7. namespace MediaBrowser.Controller.LiveTv
  8. {
  9. public class Channel : BaseItem, IItemByName
  10. {
  11. public Channel()
  12. {
  13. UserItemCountList = new List<ItemByNameCounts>();
  14. }
  15. /// <summary>
  16. /// Gets the user data key.
  17. /// </summary>
  18. /// <returns>System.String.</returns>
  19. public override string GetUserDataKey()
  20. {
  21. return "Channel-" + Name;
  22. }
  23. [IgnoreDataMember]
  24. public List<ItemByNameCounts> UserItemCountList { get; set; }
  25. /// <summary>
  26. /// Gets or sets the number.
  27. /// </summary>
  28. /// <value>The number.</value>
  29. public string ChannelNumber { get; set; }
  30. /// <summary>
  31. /// Get or sets the Id.
  32. /// </summary>
  33. /// <value>The id of the channel.</value>
  34. public string ChannelId { get; set; }
  35. /// <summary>
  36. /// Gets or sets the name of the service.
  37. /// </summary>
  38. /// <value>The name of the service.</value>
  39. public string ServiceName { get; set; }
  40. /// <summary>
  41. /// Gets or sets the type of the channel.
  42. /// </summary>
  43. /// <value>The type of the channel.</value>
  44. public ChannelType ChannelType { get; set; }
  45. public bool? HasProviderImage { get; set; }
  46. protected override string CreateSortName()
  47. {
  48. double number = 0;
  49. if (!string.IsNullOrEmpty(ChannelNumber))
  50. {
  51. double.TryParse(ChannelNumber, out number);
  52. }
  53. return number.ToString("000-") + (Name ?? string.Empty);
  54. }
  55. public override string MediaType
  56. {
  57. get
  58. {
  59. return ChannelType == ChannelType.Radio ? Model.Entities.MediaType.Audio : Model.Entities.MediaType.Video;
  60. }
  61. }
  62. }
  63. }