Series.cs 3.2 KB

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