aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Model/Configuration
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Model/Configuration')
-rw-r--r--MediaBrowser.Model/Configuration/AutoOrganize.cs36
-rw-r--r--MediaBrowser.Model/Configuration/ImageDownloadOptions.cs81
-rw-r--r--MediaBrowser.Model/Configuration/MetadataOptions.cs89
-rw-r--r--MediaBrowser.Model/Configuration/MetadataPlugin.cs60
-rw-r--r--MediaBrowser.Model/Configuration/ServerConfiguration.cs99
5 files changed, 200 insertions, 165 deletions
diff --git a/MediaBrowser.Model/Configuration/AutoOrganize.cs b/MediaBrowser.Model/Configuration/AutoOrganize.cs
new file mode 100644
index 000000000..a30aa36d8
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/AutoOrganize.cs
@@ -0,0 +1,36 @@
+
+namespace MediaBrowser.Model.Configuration
+{
+ public class TvFileOrganizationOptions
+ {
+ public bool IsEnabled { get; set; }
+ public int MinFileSizeMb { get; set; }
+ public string[] LeftOverFileExtensionsToDelete { get; set; }
+ public string[] WatchLocations { get; set; }
+
+ public string SeasonFolderPattern { get; set; }
+
+ public string SeasonZeroFolderName { get; set; }
+
+ public string EpisodeNamePattern { get; set; }
+ public string MultiEpisodeNamePattern { get; set; }
+
+ public bool OverwriteExistingEpisodes { get; set; }
+
+ public bool DeleteEmptyFolders { get; set; }
+
+ public TvFileOrganizationOptions()
+ {
+ MinFileSizeMb = 50;
+
+ LeftOverFileExtensionsToDelete = new string[] { };
+
+ WatchLocations = new string[] { };
+
+ EpisodeNamePattern = "%sn - %sx%0e - %en.%ext";
+ MultiEpisodeNamePattern = "%sn - %sx%0e-x%0ed - %en.%ext";
+ SeasonFolderPattern = "Season %s";
+ SeasonZeroFolderName = "Season 0";
+ }
+ }
+}
diff --git a/MediaBrowser.Model/Configuration/ImageDownloadOptions.cs b/MediaBrowser.Model/Configuration/ImageDownloadOptions.cs
deleted file mode 100644
index 603112110..000000000
--- a/MediaBrowser.Model/Configuration/ImageDownloadOptions.cs
+++ /dev/null
@@ -1,81 +0,0 @@
-
-namespace MediaBrowser.Model.Configuration
-{
- /// <summary>
- /// Class ImageDownloadOptions
- /// </summary>
- public class ImageDownloadOptions
- {
- /// <summary>
- /// Download Art Image
- /// </summary>
- /// <value><c>true</c> if art; otherwise, <c>false</c>.</value>
- public bool Art { get; set; }
-
- /// <summary>
- /// Download Logo Image
- /// </summary>
- /// <value><c>true</c> if logo; otherwise, <c>false</c>.</value>
- public bool Logo { get; set; }
-
- /// <summary>
- /// Download Primary Image
- /// </summary>
- /// <value><c>true</c> if primary; otherwise, <c>false</c>.</value>
- public bool Primary { get; set; }
-
- /// <summary>
- /// Download Backdrop Images
- /// </summary>
- /// <value><c>true</c> if backdrops; otherwise, <c>false</c>.</value>
- public bool Backdrops { get; set; }
-
- /// <summary>
- /// Download Disc Image
- /// </summary>
- /// <value><c>true</c> if disc; otherwise, <c>false</c>.</value>
- public bool Disc { get; set; }
-
- /// <summary>
- /// Download Thumb Image
- /// </summary>
- /// <value><c>true</c> if thumb; otherwise, <c>false</c>.</value>
- public bool Thumb { get; set; }
-
- /// <summary>
- /// Download Banner Image
- /// </summary>
- /// <value><c>true</c> if banner; otherwise, <c>false</c>.</value>
- public bool Banner { get; set; }
-
- /// <summary>
- /// Initializes a new instance of the <see cref="ImageDownloadOptions"/> class.
- /// </summary>
- public ImageDownloadOptions()
- {
- Art = true;
- Logo = true;
- Primary = true;
- Backdrops = true;
- Disc = true;
- Thumb = true;
- Banner = true;
- }
- }
-
- /// <summary>
- /// Class MetadataOptions.
- /// </summary>
- public class MetadataOptions
- {
- public int MaxBackdrops { get; set; }
-
- public int MinBackdropWidth { get; set; }
-
- public MetadataOptions()
- {
- MaxBackdrops = 3;
- MinBackdropWidth = 1280;
- }
- }
-}
diff --git a/MediaBrowser.Model/Configuration/MetadataOptions.cs b/MediaBrowser.Model/Configuration/MetadataOptions.cs
new file mode 100644
index 000000000..f914a2d21
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/MetadataOptions.cs
@@ -0,0 +1,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;
+ }
+ }
+}
diff --git a/MediaBrowser.Model/Configuration/MetadataPlugin.cs b/MediaBrowser.Model/Configuration/MetadataPlugin.cs
new file mode 100644
index 000000000..b019cf71a
--- /dev/null
+++ b/MediaBrowser.Model/Configuration/MetadataPlugin.cs
@@ -0,0 +1,60 @@
+using MediaBrowser.Model.Entities;
+using System.Collections.Generic;
+
+namespace MediaBrowser.Model.Configuration
+{
+ public class MetadataPlugin
+ {
+ /// <summary>
+ /// Gets or sets the name.
+ /// </summary>
+ /// <value>The name.</value>
+ public string Name { get; set; }
+
+ /// <summary>
+ /// Gets or sets the type.
+ /// </summary>
+ /// <value>The type.</value>
+ public MetadataPluginType Type { get; set; }
+ }
+
+ public class MetadataPluginSummary
+ {
+ /// <summary>
+ /// Gets or sets the type of the item.
+ /// </summary>
+ /// <value>The type of the item.</value>
+ public string ItemType { get; set; }
+
+ /// <summary>
+ /// Gets or sets the plugins.
+ /// </summary>
+ /// <value>The plugins.</value>
+ public List<MetadataPlugin> Plugins { get; set; }
+
+ /// <summary>
+ /// Gets or sets the supported image types.
+ /// </summary>
+ /// <value>The supported image types.</value>
+ public List<ImageType> SupportedImageTypes { get; set; }
+
+ public MetadataPluginSummary()
+ {
+ SupportedImageTypes = new List<ImageType>();
+ Plugins = new List<MetadataPlugin>();
+ }
+ }
+
+ /// <summary>
+ /// Enum MetadataPluginType
+ /// </summary>
+ public enum MetadataPluginType
+ {
+ LocalImageProvider,
+ ImageFetcher,
+ ImageSaver,
+ LocalMetadataProvider,
+ MetadataFetcher,
+ MetadataSaver
+ }
+}
diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
index 716be54d2..f874bdbb2 100644
--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs
+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs
@@ -1,4 +1,5 @@
using System.Collections.Generic;
+using System.Linq;
using MediaBrowser.Model.Weather;
using System;
@@ -88,31 +89,6 @@ namespace MediaBrowser.Model.Configuration
public string MetadataCountryCode { get; set; }
/// <summary>
- /// Options for specific art to download for movies.
- /// </summary>
- public ImageDownloadOptions DownloadMovieImages { get; set; }
-
- /// <summary>
- /// Options for specific art to download for Series.
- /// </summary>
- public ImageDownloadOptions DownloadSeriesImages { get; set; }
-
- /// <summary>
- /// Options for specific art to download for Seasons.
- /// </summary>
- public ImageDownloadOptions DownloadSeasonImages { get; set; }
-
- /// <summary>
- /// Options for specific art to download for MusicArtists.
- /// </summary>
- public ImageDownloadOptions DownloadMusicArtistImages { get; set; }
-
- /// <summary>
- /// Options for specific art to download for MusicAlbums.
- /// </summary>
- public ImageDownloadOptions DownloadMusicAlbumImages { get; set; }
-
- /// <summary>
/// Characters to be replaced with a ' ' in strings to create a sort name
/// </summary>
/// <value>The sort replace characters.</value>
@@ -215,11 +191,7 @@ namespace MediaBrowser.Model.Configuration
public bool EnableEpisodeChapterImageExtraction { get; set; }
public bool EnableOtherVideoChapterImageExtraction { get; set; }
- public MetadataOptions MovieOptions { get; set; }
- public MetadataOptions TvOptions { get; set; }
- public MetadataOptions MusicOptions { get; set; }
- public MetadataOptions GameOptions { get; set; }
- public MetadataOptions BookOptions { get; set; }
+ public MetadataOptions[] MetadataOptions { get; set; }
public bool EnableDebugEncodingLogging { get; set; }
public string TranscodingTempPath { get; set; }
@@ -267,14 +239,6 @@ namespace MediaBrowser.Model.Configuration
MetadataRefreshDays = 30;
PreferredMetadataLanguage = "en";
MetadataCountryCode = "US";
- DownloadMovieImages = new ImageDownloadOptions();
- DownloadSeriesImages = new ImageDownloadOptions();
- DownloadSeasonImages = new ImageDownloadOptions
- {
- Backdrops = false
- };
- DownloadMusicArtistImages = new ImageDownloadOptions();
- DownloadMusicAlbumImages = new ImageDownloadOptions();
SortReplaceCharacters = new[] { ".", "+", "%" };
SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" };
@@ -282,26 +246,26 @@ namespace MediaBrowser.Model.Configuration
SeasonZeroDisplayName = "Specials";
- MovieOptions = new MetadataOptions();
- TvOptions = new MetadataOptions();
+ LiveTvOptions = new LiveTvOptions();
- MusicOptions = new MetadataOptions()
- {
- MaxBackdrops = 1
- };
+ TvFileOrganizationOptions = new TvFileOrganizationOptions();
- GameOptions = new MetadataOptions();
+ EnableRealtimeMonitor = true;
- BookOptions = new MetadataOptions
+ var options = new List<MetadataOptions>
{
- MaxBackdrops = 1
+ new MetadataOptions(1, 1280) {ItemType = "Book"},
+ new MetadataOptions(1, 1280) {ItemType = "MusicAlbum"},
+ new MetadataOptions(1, 1280) {ItemType = "MusicArtist"},
+ new MetadataOptions(0, 1280) {ItemType = "Season"}
};
- LiveTvOptions = new LiveTvOptions();
-
- TvFileOrganizationOptions = new TvFileOrganizationOptions();
+ MetadataOptions = options.ToArray();
+ }
- EnableRealtimeMonitor = true;
+ public MetadataOptions GetMetadataOptions(string type)
+ {
+ return MetadataOptions.FirstOrDefault(i => string.Equals(i.ItemType, type, StringComparison.OrdinalIgnoreCase));
}
}
@@ -324,39 +288,6 @@ namespace MediaBrowser.Model.Configuration
public int? GuideDays { get; set; }
}
- public class TvFileOrganizationOptions
- {
- public bool IsEnabled { get; set; }
- public int MinFileSizeMb { get; set; }
- public string[] LeftOverFileExtensionsToDelete { get; set; }
- public string[] WatchLocations { get; set; }
-
- public string SeasonFolderPattern { get; set; }
-
- public string SeasonZeroFolderName { get; set; }
-
- public string EpisodeNamePattern { get; set; }
- public string MultiEpisodeNamePattern { get; set; }
-
- public bool OverwriteExistingEpisodes { get; set; }
-
- public bool DeleteEmptyFolders { get; set; }
-
- public TvFileOrganizationOptions()
- {
- MinFileSizeMb = 50;
-
- LeftOverFileExtensionsToDelete = new string[] {};
-
- WatchLocations = new string[] { };
-
- EpisodeNamePattern = "%sn - %sx%0e - %en.%ext";
- MultiEpisodeNamePattern = "%sn - %sx%0e-x%0ed - %en.%ext";
- SeasonFolderPattern = "Season %s";
- SeasonZeroFolderName = "Season 0";
- }
- }
-
public class PathSubstitution
{
public string From { get; set; }