jellyfin/MediaBrowser.Model/Configuration/MetadataOptions.cs

92 lines
2.5 KiB
C#
Raw Normal View History

2014-02-02 13:36:31 +00:00
using MediaBrowser.Model.Entities;
2014-06-23 16:05:19 +00:00
using MediaBrowser.Model.Extensions;
2014-02-02 13:36:31 +00:00
using System.Collections.Generic;
namespace MediaBrowser.Model.Configuration
{
/// <summary>
/// Class MetadataOptions.
/// </summary>
public class MetadataOptions
{
public string ItemType { get; set; }
public ImageOption[] ImageOptions { get; set; }
public string[] DisabledMetadataSavers { get; set; }
2014-02-11 04:55:01 +00:00
public string[] LocalMetadataReaderOrder { get; set; }
2014-02-02 13:36:31 +00:00
2014-02-11 04:55:01 +00:00
public string[] DisabledMetadataFetchers { get; set; }
public string[] MetadataFetcherOrder { get; set; }
public string[] DisabledImageFetchers { get; set; }
public string[] ImageFetcherOrder { get; set; }
2014-02-02 13:36:31 +00:00
public MetadataOptions()
: this(3, 1280)
{
}
public MetadataOptions(int backdropLimit, int minBackdropWidth)
{
2017-08-19 19:43:35 +00:00
ImageOptions = new[]
2014-02-02 13:36:31 +00:00
{
new ImageOption
{
Limit = backdropLimit,
MinWidth = minBackdropWidth,
Type = ImageType.Backdrop
}
};
DisabledMetadataSavers = new string[] { };
2014-02-11 04:55:01 +00:00
LocalMetadataReaderOrder = new string[] { };
DisabledMetadataFetchers = new string[] { };
MetadataFetcherOrder = new string[] { };
DisabledImageFetchers = new string[] { };
ImageFetcherOrder = new string[] { };
2014-02-02 13:36:31 +00:00
}
public int GetLimit(ImageType type)
{
ImageOption option = null;
foreach (ImageOption i in ImageOptions)
{
if (i.Type == type)
{
option = i;
break;
}
}
2014-02-02 13:36:31 +00:00
return option == null ? 1 : option.Limit;
}
public int GetMinWidth(ImageType type)
{
ImageOption option = null;
foreach (ImageOption i in ImageOptions)
{
if (i.Type == type)
{
option = i;
break;
}
}
2014-02-02 13:36:31 +00:00
return option == null ? 0 : option.MinWidth;
}
public bool IsEnabled(ImageType type)
{
return GetLimit(type) > 0;
}
public bool IsMetadataSaverEnabled(string name)
{
2014-06-23 16:05:19 +00:00
return !ListHelper.ContainsIgnoreCase(DisabledMetadataSavers, name);
2014-02-02 13:36:31 +00:00
}
}
}