LiveTvVideoRecording.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using MediaBrowser.Controller.Entities;
  2. using MediaBrowser.Model.Configuration;
  3. using MediaBrowser.Model.Entities;
  4. using System.Linq;
  5. using MediaBrowser.Model.Users;
  6. namespace MediaBrowser.Controller.LiveTv
  7. {
  8. public class LiveTvVideoRecording : Video, ILiveTvRecording
  9. {
  10. /// <summary>
  11. /// Gets the user data key.
  12. /// </summary>
  13. /// <returns>System.String.</returns>
  14. public override string GetUserDataKey()
  15. {
  16. var name = GetClientTypeName();
  17. if (!string.IsNullOrEmpty(RecordingInfo.ProgramId))
  18. {
  19. return name + "-" + RecordingInfo.ProgramId;
  20. }
  21. return name + "-" + RecordingInfo.Name + (RecordingInfo.EpisodeTitle ?? string.Empty);
  22. }
  23. public RecordingInfo RecordingInfo { get; set; }
  24. public string ServiceName { get; set; }
  25. public override string MediaType
  26. {
  27. get
  28. {
  29. return Model.Entities.MediaType.Video;
  30. }
  31. }
  32. public override LocationType LocationType
  33. {
  34. get
  35. {
  36. if (!string.IsNullOrEmpty(Path))
  37. {
  38. return base.LocationType;
  39. }
  40. return LocationType.Remote;
  41. }
  42. }
  43. /// <summary>
  44. /// Gets a value indicating whether this instance is owned item.
  45. /// </summary>
  46. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  47. public override bool IsOwnedItem
  48. {
  49. get
  50. {
  51. return false;
  52. }
  53. }
  54. public override string GetClientTypeName()
  55. {
  56. return "Recording";
  57. }
  58. public override bool IsSaveLocalMetadataEnabled()
  59. {
  60. return false;
  61. }
  62. public override bool SupportsLocalMetadata
  63. {
  64. get
  65. {
  66. return false;
  67. }
  68. }
  69. protected override bool GetBlockUnratedValue(UserPolicy config)
  70. {
  71. return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
  72. }
  73. }
  74. }