LibraryOptions.cs 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153
  1. #pragma warning disable CS1591
  2. using System;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. namespace MediaBrowser.Model.Configuration
  6. {
  7. public class LibraryOptions
  8. {
  9. private static readonly string[] _defaultTagDelimiters = ["/", "|", ";", "\\"];
  10. public LibraryOptions()
  11. {
  12. TypeOptions = Array.Empty<TypeOptions>();
  13. DisabledSubtitleFetchers = Array.Empty<string>();
  14. DisabledMediaSegmentProviders = Array.Empty<string>();
  15. MediaSegmentProviderOrder = Array.Empty<string>();
  16. SubtitleFetcherOrder = Array.Empty<string>();
  17. DisabledLocalMetadataReaders = Array.Empty<string>();
  18. DisabledLyricFetchers = Array.Empty<string>();
  19. LyricFetcherOrder = Array.Empty<string>();
  20. SkipSubtitlesIfAudioTrackMatches = true;
  21. RequirePerfectSubtitleMatch = true;
  22. AllowEmbeddedSubtitles = EmbeddedSubtitleOptions.AllowAll;
  23. AutomaticallyAddToCollection = false;
  24. EnablePhotos = true;
  25. SaveSubtitlesWithMedia = true;
  26. SaveLyricsWithMedia = false;
  27. SaveTrickplayWithMedia = false;
  28. PathInfos = Array.Empty<MediaPathInfo>();
  29. EnableAutomaticSeriesGrouping = true;
  30. SeasonZeroDisplayName = "Specials";
  31. PreferNonstandardArtistsTag = false;
  32. UseCustomTagDelimiters = false;
  33. CustomTagDelimiters = _defaultTagDelimiters;
  34. DelimiterWhitelist = Array.Empty<string>();
  35. }
  36. public bool Enabled { get; set; } = true;
  37. public bool EnablePhotos { get; set; }
  38. public bool EnableRealtimeMonitor { get; set; }
  39. public bool EnableLUFSScan { get; set; }
  40. public bool EnableChapterImageExtraction { get; set; }
  41. public bool ExtractChapterImagesDuringLibraryScan { get; set; }
  42. public bool EnableTrickplayImageExtraction { get; set; }
  43. public bool ExtractTrickplayImagesDuringLibraryScan { get; set; }
  44. public MediaPathInfo[] PathInfos { get; set; }
  45. public bool SaveLocalMetadata { get; set; }
  46. [Obsolete("Disable remote providers in TypeOptions instead")]
  47. public bool EnableInternetProviders { get; set; }
  48. public bool EnableAutomaticSeriesGrouping { get; set; }
  49. public bool EnableEmbeddedTitles { get; set; }
  50. public bool EnableEmbeddedExtrasTitles { get; set; }
  51. public bool EnableEmbeddedEpisodeInfos { get; set; }
  52. public int AutomaticRefreshIntervalDays { get; set; }
  53. /// <summary>
  54. /// Gets or sets the preferred metadata language.
  55. /// </summary>
  56. /// <value>The preferred metadata language.</value>
  57. public string? PreferredMetadataLanguage { get; set; }
  58. /// <summary>
  59. /// Gets or sets the metadata country code.
  60. /// </summary>
  61. /// <value>The metadata country code.</value>
  62. public string? MetadataCountryCode { get; set; }
  63. public string SeasonZeroDisplayName { get; set; }
  64. public string[]? MetadataSavers { get; set; }
  65. public string[] DisabledLocalMetadataReaders { get; set; }
  66. public string[]? LocalMetadataReaderOrder { get; set; }
  67. public string[] DisabledSubtitleFetchers { get; set; }
  68. public string[] SubtitleFetcherOrder { get; set; }
  69. public string[] DisabledMediaSegmentProviders { get; set; }
  70. public string[] MediaSegmentProviderOrder { get; set; }
  71. public bool SkipSubtitlesIfEmbeddedSubtitlesPresent { get; set; }
  72. public bool SkipSubtitlesIfAudioTrackMatches { get; set; }
  73. public string[]? SubtitleDownloadLanguages { get; set; }
  74. public bool RequirePerfectSubtitleMatch { get; set; }
  75. public bool SaveSubtitlesWithMedia { get; set; }
  76. [DefaultValue(false)]
  77. public bool SaveLyricsWithMedia { get; set; }
  78. [DefaultValue(false)]
  79. public bool SaveTrickplayWithMedia { get; set; }
  80. public string[] DisabledLyricFetchers { get; set; }
  81. public string[] LyricFetcherOrder { get; set; }
  82. [DefaultValue(false)]
  83. public bool PreferNonstandardArtistsTag { get; set; }
  84. [DefaultValue(false)]
  85. public bool UseCustomTagDelimiters { get; set; }
  86. public string[] CustomTagDelimiters { get; set; }
  87. public string[] DelimiterWhitelist { get; set; }
  88. public bool AutomaticallyAddToCollection { get; set; }
  89. public EmbeddedSubtitleOptions AllowEmbeddedSubtitles { get; set; }
  90. public TypeOptions[] TypeOptions { get; set; }
  91. public TypeOptions? GetTypeOptions(string type)
  92. {
  93. foreach (var options in TypeOptions)
  94. {
  95. if (string.Equals(options.Type, type, StringComparison.OrdinalIgnoreCase))
  96. {
  97. return options;
  98. }
  99. }
  100. return null;
  101. }
  102. }
  103. }