2014-02-02 06:36:31 -07:00
|
|
|
|
using MediaBrowser.Model.Entities;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
|
|
|
|
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-10 21:55:01 -07:00
|
|
|
|
public string[] LocalMetadataReaderOrder { get; set; }
|
2014-02-02 06:36:31 -07:00
|
|
|
|
|
2014-02-10 21:55:01 -07:00
|
|
|
|
public string[] DisabledMetadataFetchers { get; set; }
|
|
|
|
|
public string[] MetadataFetcherOrder { get; set; }
|
|
|
|
|
|
|
|
|
|
public string[] DisabledImageFetchers { get; set; }
|
|
|
|
|
public string[] ImageFetcherOrder { get; set; }
|
|
|
|
|
|
2014-02-02 06:36:31 -07:00
|
|
|
|
public MetadataOptions()
|
|
|
|
|
: this(3, 1280)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public MetadataOptions(int backdropLimit, int minBackdropWidth)
|
|
|
|
|
{
|
2014-05-08 13:09:53 -07:00
|
|
|
|
List<ImageOption> imageOptions = new List<ImageOption>
|
2014-02-02 06:36:31 -07:00
|
|
|
|
{
|
|
|
|
|
new ImageOption
|
|
|
|
|
{
|
|
|
|
|
Limit = backdropLimit,
|
|
|
|
|
MinWidth = minBackdropWidth,
|
|
|
|
|
Type = ImageType.Backdrop
|
|
|
|
|
}
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
ImageOptions = imageOptions.ToArray();
|
|
|
|
|
DisabledMetadataSavers = new string[] { };
|
2014-02-10 21:55:01 -07:00
|
|
|
|
LocalMetadataReaderOrder = new string[] { };
|
|
|
|
|
|
|
|
|
|
DisabledMetadataFetchers = new string[] { };
|
|
|
|
|
MetadataFetcherOrder = new string[] { };
|
|
|
|
|
DisabledImageFetchers = new string[] { };
|
|
|
|
|
ImageFetcherOrder = new string[] { };
|
2014-02-02 06:36:31 -07:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetLimit(ImageType type)
|
|
|
|
|
{
|
2014-05-08 13:09:53 -07:00
|
|
|
|
ImageOption option = ImageOptions.FirstOrDefault(i => i.Type == type);
|
2014-02-02 06:36:31 -07:00
|
|
|
|
|
|
|
|
|
return option == null ? 1 : option.Limit;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int GetMinWidth(ImageType type)
|
|
|
|
|
{
|
2014-05-08 13:09:53 -07:00
|
|
|
|
ImageOption option = ImageOptions.FirstOrDefault(i => i.Type == type);
|
2014-02-02 06:36:31 -07:00
|
|
|
|
|
|
|
|
|
return option == null ? 0 : option.MinWidth;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsEnabled(ImageType type)
|
|
|
|
|
{
|
|
|
|
|
return GetLimit(type) > 0;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool IsMetadataSaverEnabled(string name)
|
|
|
|
|
{
|
|
|
|
|
return !DisabledMetadataSavers.Contains(name, StringComparer.OrdinalIgnoreCase);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public class ImageOption
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the type.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The type.</value>
|
|
|
|
|
public ImageType Type { get; set; }
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the limit.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The limit.</value>
|
|
|
|
|
public int Limit { get; set; }
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Gets or sets the minimum width.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <value>The minimum width.</value>
|
|
|
|
|
public int MinWidth { get; set; }
|
|
|
|
|
|
|
|
|
|
public ImageOption()
|
|
|
|
|
{
|
|
|
|
|
Limit = 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|