Series.cs 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114
  1. using MediaBrowser.Controller.Library;
  2. using MediaBrowser.Controller.Localization;
  3. using MediaBrowser.Model.Entities;
  4. using System;
  5. using System.Collections.Generic;
  6. using System.IO;
  7. using System.Linq;
  8. using System.Runtime.Serialization;
  9. namespace MediaBrowser.Controller.Entities.TV
  10. {
  11. /// <summary>
  12. /// Class Series
  13. /// </summary>
  14. public class Series : Folder, IHasSoundtracks, IHasTrailers
  15. {
  16. public List<Guid> SpecialFeatureIds { get; set; }
  17. public List<Guid> SoundtrackIds { get; set; }
  18. public int SeasonCount { get; set; }
  19. public Series()
  20. {
  21. AirDays = new List<DayOfWeek>();
  22. SpecialFeatureIds = new List<Guid>();
  23. SoundtrackIds = new List<Guid>();
  24. RemoteTrailers = new List<MediaUrl>();
  25. LocalTrailerIds = new List<Guid>();
  26. }
  27. public List<Guid> LocalTrailerIds { get; set; }
  28. public List<MediaUrl> RemoteTrailers { get; set; }
  29. /// <summary>
  30. /// Gets or sets the status.
  31. /// </summary>
  32. /// <value>The status.</value>
  33. public SeriesStatus? Status { get; set; }
  34. /// <summary>
  35. /// Gets or sets the air days.
  36. /// </summary>
  37. /// <value>The air days.</value>
  38. public List<DayOfWeek> AirDays { get; set; }
  39. /// <summary>
  40. /// Gets or sets the air time.
  41. /// </summary>
  42. /// <value>The air time.</value>
  43. public string AirTime { get; set; }
  44. /// <summary>
  45. /// Gets or sets the date last episode added.
  46. /// </summary>
  47. /// <value>The date last episode added.</value>
  48. public DateTime DateLastEpisodeAdded { get; set; }
  49. /// <summary>
  50. /// Series aren't included directly in indices - Their Episodes will roll up to them
  51. /// </summary>
  52. /// <value><c>true</c> if [include in index]; otherwise, <c>false</c>.</value>
  53. [IgnoreDataMember]
  54. public override bool IncludeInIndex
  55. {
  56. get
  57. {
  58. return false;
  59. }
  60. }
  61. /// <summary>
  62. /// Gets the user data key.
  63. /// </summary>
  64. /// <returns>System.String.</returns>
  65. public override string GetUserDataKey()
  66. {
  67. return this.GetProviderId(MetadataProviders.Tvdb) ?? this.GetProviderId(MetadataProviders.Tvcom) ?? base.GetUserDataKey();
  68. }
  69. // Studio, Genre and Rating will all be the same so makes no sense to index by these
  70. protected override Dictionary<string, Func<User, IEnumerable<BaseItem>>> GetIndexByOptions()
  71. {
  72. return new Dictionary<string, Func<User, IEnumerable<BaseItem>>> {
  73. {LocalizedStrings.Instance.GetString("NoneDispPref"), null},
  74. {LocalizedStrings.Instance.GetString("PerformerDispPref"), GetIndexByPerformer},
  75. {LocalizedStrings.Instance.GetString("DirectorDispPref"), GetIndexByDirector},
  76. {LocalizedStrings.Instance.GetString("YearDispPref"), GetIndexByYear},
  77. };
  78. }
  79. /// <summary>
  80. /// Creates ResolveArgs on demand
  81. /// </summary>
  82. /// <param name="pathInfo">The path info.</param>
  83. /// <returns>ItemResolveArgs.</returns>
  84. protected internal override ItemResolveArgs CreateResolveArgs(FileSystemInfo pathInfo = null)
  85. {
  86. var args = base.CreateResolveArgs(pathInfo);
  87. Season.AddMetadataFiles(args);
  88. return args;
  89. }
  90. [IgnoreDataMember]
  91. public bool ContainsEpisodesWithoutSeasonFolders
  92. {
  93. get
  94. {
  95. return Children.OfType<Video>().Any();
  96. }
  97. }
  98. }
  99. }