LibraryOptions.cs 4.9 KB

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