blob: f914a2d21b822995c04c5483f86ca9f661872306 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
|
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; }
public MetadataOptions()
: this(3, 1280)
{
}
public MetadataOptions(int backdropLimit, int minBackdropWidth)
{
var imageOptions = new List<ImageOption>
{
new ImageOption
{
Limit = backdropLimit,
MinWidth = minBackdropWidth,
Type = ImageType.Backdrop
}
};
ImageOptions = imageOptions.ToArray();
DisabledMetadataSavers = new string[] { };
}
public int GetLimit(ImageType type)
{
var option = ImageOptions.FirstOrDefault(i => i.Type == type);
return option == null ? 1 : option.Limit;
}
public int GetMinWidth(ImageType type)
{
var option = ImageOptions.FirstOrDefault(i => i.Type == type);
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;
}
}
}
|