From 9e0c1340fc3ad4b41e3c349b98ea71b708ade95a Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 2 Feb 2014 08:36:31 -0500 Subject: convert games to new providers --- MediaBrowser.Model/Configuration/AutoOrganize.cs | 36 ++++++++ .../Configuration/ImageDownloadOptions.cs | 81 ------------------ .../Configuration/MetadataOptions.cs | 89 +++++++++++++++++++ MediaBrowser.Model/Configuration/MetadataPlugin.cs | 60 +++++++++++++ .../Configuration/ServerConfiguration.cs | 99 ++++------------------ 5 files changed, 200 insertions(+), 165 deletions(-) create mode 100644 MediaBrowser.Model/Configuration/AutoOrganize.cs delete mode 100644 MediaBrowser.Model/Configuration/ImageDownloadOptions.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataOptions.cs create mode 100644 MediaBrowser.Model/Configuration/MetadataPlugin.cs (limited to 'MediaBrowser.Model/Configuration') 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 -{ - /// - /// Class ImageDownloadOptions - /// - public class ImageDownloadOptions - { - /// - /// Download Art Image - /// - /// true if art; otherwise, false. - public bool Art { get; set; } - - /// - /// Download Logo Image - /// - /// true if logo; otherwise, false. - public bool Logo { get; set; } - - /// - /// Download Primary Image - /// - /// true if primary; otherwise, false. - public bool Primary { get; set; } - - /// - /// Download Backdrop Images - /// - /// true if backdrops; otherwise, false. - public bool Backdrops { get; set; } - - /// - /// Download Disc Image - /// - /// true if disc; otherwise, false. - public bool Disc { get; set; } - - /// - /// Download Thumb Image - /// - /// true if thumb; otherwise, false. - public bool Thumb { get; set; } - - /// - /// Download Banner Image - /// - /// true if banner; otherwise, false. - public bool Banner { get; set; } - - /// - /// Initializes a new instance of the class. - /// - public ImageDownloadOptions() - { - Art = true; - Logo = true; - Primary = true; - Backdrops = true; - Disc = true; - Thumb = true; - Banner = true; - } - } - - /// - /// Class MetadataOptions. - /// - 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 +{ + /// + /// Class MetadataOptions. + /// + 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 + { + 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 + { + /// + /// Gets or sets the type. + /// + /// The type. + public ImageType Type { get; set; } + /// + /// Gets or sets the limit. + /// + /// The limit. + public int Limit { get; set; } + + /// + /// Gets or sets the minimum width. + /// + /// The minimum width. + 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 + { + /// + /// Gets or sets the name. + /// + /// The name. + public string Name { get; set; } + + /// + /// Gets or sets the type. + /// + /// The type. + public MetadataPluginType Type { get; set; } + } + + public class MetadataPluginSummary + { + /// + /// Gets or sets the type of the item. + /// + /// The type of the item. + public string ItemType { get; set; } + + /// + /// Gets or sets the plugins. + /// + /// The plugins. + public List Plugins { get; set; } + + /// + /// Gets or sets the supported image types. + /// + /// The supported image types. + public List SupportedImageTypes { get; set; } + + public MetadataPluginSummary() + { + SupportedImageTypes = new List(); + Plugins = new List(); + } + } + + /// + /// Enum MetadataPluginType + /// + 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; @@ -87,31 +88,6 @@ namespace MediaBrowser.Model.Configuration /// The metadata country code. public string MetadataCountryCode { get; set; } - /// - /// Options for specific art to download for movies. - /// - public ImageDownloadOptions DownloadMovieImages { get; set; } - - /// - /// Options for specific art to download for Series. - /// - public ImageDownloadOptions DownloadSeriesImages { get; set; } - - /// - /// Options for specific art to download for Seasons. - /// - public ImageDownloadOptions DownloadSeasonImages { get; set; } - - /// - /// Options for specific art to download for MusicArtists. - /// - public ImageDownloadOptions DownloadMusicArtistImages { get; set; } - - /// - /// Options for specific art to download for MusicAlbums. - /// - public ImageDownloadOptions DownloadMusicAlbumImages { get; set; } - /// /// Characters to be replaced with a ' ' in strings to create a sort name /// @@ -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 { - 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; } -- cgit v1.2.3