LiveTvVideoRecording.cs 2.5 KB

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