Channel.cs 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  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. UserItemCounts = new Dictionary<Guid, 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 Dictionary<Guid, ItemByNameCounts> UserItemCounts { 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. protected override string CreateSortName()
  46. {
  47. double number = 0;
  48. if (!string.IsNullOrEmpty(ChannelNumber))
  49. {
  50. double.TryParse(ChannelNumber, out number);
  51. }
  52. return number.ToString("000-") + (Name ?? string.Empty);
  53. }
  54. }
  55. }