LiveTvAudioRecording.cs 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697
  1. using System.Runtime.Serialization;
  2. using MediaBrowser.Controller.Entities.Audio;
  3. using MediaBrowser.Model.Configuration;
  4. using MediaBrowser.Model.Entities;
  5. using MediaBrowser.Model.Users;
  6. using System.Linq;
  7. namespace MediaBrowser.Controller.LiveTv
  8. {
  9. public class LiveTvAudioRecording : Audio, 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. /// <summary>
  27. /// Gets a value indicating whether this instance is owned item.
  28. /// </summary>
  29. /// <value><c>true</c> if this instance is owned item; otherwise, <c>false</c>.</value>
  30. [IgnoreDataMember]
  31. public override bool IsOwnedItem
  32. {
  33. get
  34. {
  35. return false;
  36. }
  37. }
  38. [IgnoreDataMember]
  39. public override string MediaType
  40. {
  41. get
  42. {
  43. return Model.Entities.MediaType.Audio;
  44. }
  45. }
  46. [IgnoreDataMember]
  47. public override LocationType LocationType
  48. {
  49. get
  50. {
  51. if (!string.IsNullOrEmpty(Path))
  52. {
  53. return base.LocationType;
  54. }
  55. return LocationType.Remote;
  56. }
  57. }
  58. public override string GetClientTypeName()
  59. {
  60. return "Recording";
  61. }
  62. public override bool IsSaveLocalMetadataEnabled()
  63. {
  64. return false;
  65. }
  66. [IgnoreDataMember]
  67. public override bool SupportsLocalMetadata
  68. {
  69. get
  70. {
  71. return false;
  72. }
  73. }
  74. protected override bool GetBlockUnratedValue(UserPolicy config)
  75. {
  76. return config.BlockUnratedItems.Contains(UnratedItem.LiveTvProgram);
  77. }
  78. protected override string GetInternalMetadataPath(string basePath)
  79. {
  80. return System.IO.Path.Combine(basePath, "livetv", Id.ToString("N"));
  81. }
  82. }
  83. }