LiveTvAudioRecording.cs 2.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  1. using MediaBrowser.Controller.Entities.Audio;
  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 LiveTvAudioRecording : Audio, 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. /// <summary>
  26. /// Gets a value indicating whether this instance is owned item.
  27. /// </summary>
  28. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  29. public override bool IsOwnedItem
  30. {
  31. get
  32. {
  33. return false;
  34. }
  35. }
  36. public override string MediaType
  37. {
  38. get
  39. {
  40. return Model.Entities.MediaType.Audio;
  41. }
  42. }
  43. public override LocationType LocationType
  44. {
  45. get
  46. {
  47. if (!string.IsNullOrEmpty(Path))
  48. {
  49. return base.LocationType;
  50. }
  51. return LocationType.Remote;
  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. }