2
0

MetadataConfigurationExtensions.cs 1.1 KB

123456789101112131415161718192021222324
  1. #pragma warning disable CS1591
  2. using System;
  3. using MediaBrowser.Common.Configuration;
  4. using MediaBrowser.Controller.Configuration;
  5. using MediaBrowser.Model.Configuration;
  6. namespace MediaBrowser.Controller.Library
  7. {
  8. public static class MetadataConfigurationExtensions
  9. {
  10. public static MetadataConfiguration GetMetadataConfiguration(this IConfigurationManager config)
  11. => config.GetConfiguration<MetadataConfiguration>("metadata");
  12. /// <summary>
  13. /// Gets the <see cref="MetadataOptions" /> for the specified type.
  14. /// </summary>
  15. /// <param name="config">The <see cref="IServerConfigurationManager"/>.</param>
  16. /// <param name="type">The type to get the <see cref="MetadataOptions" /> for.</param>
  17. /// <returns>The <see cref="MetadataOptions" /> for the specified type or <c>null</c>.</returns>
  18. public static MetadataOptions? GetMetadataOptionsForType(this IServerConfigurationManager config, string type)
  19. => Array.Find(config.Configuration.MetadataOptions, i => string.Equals(i.ItemType, type, StringComparison.OrdinalIgnoreCase));
  20. }
  21. }