Trailer.cs 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. using System.Runtime.Serialization;
  2. namespace MediaBrowser.Controller.Entities
  3. {
  4. /// <summary>
  5. /// Class Trailer
  6. /// </summary>
  7. public class Trailer : Video
  8. {
  9. /// <summary>
  10. /// Gets a value indicating whether this instance is local trailer.
  11. /// </summary>
  12. /// <value><c>true</c> if this instance is local trailer; otherwise, <c>false</c>.</value>
  13. [IgnoreDataMember]
  14. public bool IsLocalTrailer
  15. {
  16. get
  17. {
  18. // Local trailers are not part of children
  19. return Parent == null;
  20. }
  21. }
  22. /// <summary>
  23. /// Should be overridden to return the proper folder where metadata lives
  24. /// </summary>
  25. /// <value>The meta location.</value>
  26. [IgnoreDataMember]
  27. public override string MetaLocation
  28. {
  29. get
  30. {
  31. if (!IsLocalTrailer)
  32. {
  33. return System.IO.Path.GetDirectoryName(Path);
  34. }
  35. return base.MetaLocation;
  36. }
  37. }
  38. /// <summary>
  39. /// Needed because the resolver stops at the trailer folder and we find the video inside.
  40. /// </summary>
  41. /// <value><c>true</c> if [use parent path to create resolve args]; otherwise, <c>false</c>.</value>
  42. protected override bool UseParentPathToCreateResolveArgs
  43. {
  44. get { return !IsLocalTrailer; }
  45. }
  46. }
  47. }