From 25db52003c20473e94e07fb02adf43549a4ba213 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 26 Dec 2013 01:17:19 -0500 Subject: added more metadata control --- .../MediaBrowser.Model.Portable.csproj | 6 +- .../MediaBrowser.Model.net35.csproj | 6 +- .../Configuration/ImageDownloadOptions.cs | 81 ++++++++++++++++++++++ .../Configuration/ServerConfiguration.cs | 44 ++++++------ .../Entities/ImageDownloadOptions.cs | 65 ----------------- MediaBrowser.Model/MediaBrowser.Model.csproj | 2 +- .../Movies/FanArtMovieProvider.cs | 2 +- .../Movies/MovieDbImagesProvider.cs | 8 +-- .../Music/FanArtArtistProvider.cs | 2 +- MediaBrowser.Providers/TV/FanArtTVProvider.cs | 2 +- .../TV/TvdbSeriesImageProvider.cs | 4 +- .../Drawing/ImageProcessor.cs | 7 +- MediaBrowser.WebDashboard/Api/DashboardService.cs | 3 +- .../MediaBrowser.WebDashboard.csproj | 10 +-- 14 files changed, 122 insertions(+), 120 deletions(-) create mode 100644 MediaBrowser.Model/Configuration/ImageDownloadOptions.cs delete mode 100644 MediaBrowser.Model/Entities/ImageDownloadOptions.cs diff --git a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj index c89dcf4a5..36e666021 100644 --- a/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj +++ b/MediaBrowser.Model.Portable/MediaBrowser.Model.Portable.csproj @@ -77,6 +77,9 @@ Configuration\BaseApplicationConfiguration.cs + + Configuration\ImageDownloadOptions.cs + Configuration\ManualLoginCategory.cs @@ -146,9 +149,6 @@ Entities\IHasProviderIds.cs - - Entities\ImageDownloadOptions.cs - Entities\ImageType.cs diff --git a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj index 78f970969..7937bc403 100644 --- a/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj +++ b/MediaBrowser.Model.net35/MediaBrowser.Model.net35.csproj @@ -64,6 +64,9 @@ Configuration\BaseApplicationConfiguration.cs + + Configuration\ImageDownloadOptions.cs + Configuration\ManualLoginCategory.cs @@ -133,9 +136,6 @@ Entities\IHasProviderIds.cs - - Entities\ImageDownloadOptions.cs - Entities\ImageType.cs diff --git a/MediaBrowser.Model/Configuration/ImageDownloadOptions.cs b/MediaBrowser.Model/Configuration/ImageDownloadOptions.cs new file mode 100644 index 000000000..603112110 --- /dev/null +++ b/MediaBrowser.Model/Configuration/ImageDownloadOptions.cs @@ -0,0 +1,81 @@ + +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/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.cs index 9527fcbf3..c8c205404 100644 --- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs +++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs @@ -1,5 +1,4 @@ -using MediaBrowser.Model.Entities; -using MediaBrowser.Model.Weather; +using MediaBrowser.Model.Weather; using System; namespace MediaBrowser.Model.Configuration @@ -87,12 +86,6 @@ namespace MediaBrowser.Model.Configuration /// The metadata country code. public string MetadataCountryCode { get; set; } - /// - /// Gets or sets the max backdrops. - /// - /// The max backdrops. - public int MaxBackdrops { get; set; } - /// /// Options for specific art to download for movies. /// @@ -204,18 +197,6 @@ namespace MediaBrowser.Model.Configuration /// The image saving convention. public ImageSavingConvention ImageSavingConvention { get; set; } - /// - /// Gets or sets the width of the min movie backdrop. - /// - /// The width of the min movie backdrop. - public int MinMovieBackdropDownloadWidth { get; set; } - - /// - /// Gets or sets the width of the min series backdrop. - /// - /// The width of the min series backdrop. - public int MinSeriesBackdropDownloadWidth { get; set; } - /// /// Gets or sets a value indicating whether [enable people prefix sub folders]. /// @@ -232,6 +213,12 @@ 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; } + /// /// Initializes a new instance of the class. /// @@ -272,7 +259,6 @@ namespace MediaBrowser.Model.Configuration }; DownloadMusicArtistImages = new ImageDownloadOptions(); DownloadMusicAlbumImages = new ImageDownloadOptions(); - MaxBackdrops = 3; SortReplaceCharacters = new[] { ".", "+", "%" }; SortRemoveCharacters = new[] { ",", "&", "-", "{", "}", "'" }; @@ -280,8 +266,20 @@ namespace MediaBrowser.Model.Configuration SeasonZeroDisplayName = "Specials"; - MinMovieBackdropDownloadWidth = 1280; - MinSeriesBackdropDownloadWidth = 1280; + MovieOptions = new MetadataOptions(); + TvOptions = new MetadataOptions(); + + MusicOptions = new MetadataOptions() + { + MaxBackdrops = 1 + }; + + GameOptions = new MetadataOptions(); + + BookOptions = new MetadataOptions + { + MaxBackdrops = 1 + }; } } diff --git a/MediaBrowser.Model/Entities/ImageDownloadOptions.cs b/MediaBrowser.Model/Entities/ImageDownloadOptions.cs deleted file mode 100644 index 92e989a34..000000000 --- a/MediaBrowser.Model/Entities/ImageDownloadOptions.cs +++ /dev/null @@ -1,65 +0,0 @@ - -namespace MediaBrowser.Model.Entities -{ - /// - /// 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; - } - } -} diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csproj index 2bebe7ee5..05bc0a40d 100644 --- a/MediaBrowser.Model/MediaBrowser.Model.csproj +++ b/MediaBrowser.Model/MediaBrowser.Model.csproj @@ -118,7 +118,7 @@ - + diff --git a/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs b/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs index 3ee273145..2682cf3c0 100644 --- a/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs +++ b/MediaBrowser.Providers/Movies/FanArtMovieProvider.cs @@ -300,7 +300,7 @@ namespace MediaBrowser.Providers.Movies cancellationToken.ThrowIfCancellationRequested(); - var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops; + var backdropLimit = ConfigurationManager.Configuration.MovieOptions.MaxBackdrops; if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit) { diff --git a/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs b/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs index 6ea8e699a..4416671fa 100644 --- a/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs +++ b/MediaBrowser.Providers/Movies/MovieDbImagesProvider.cs @@ -132,8 +132,8 @@ namespace MediaBrowser.Providers.Movies } // Don't refresh if we already have both poster and backdrop and we're not refreshing images - if (item.HasImage(ImageType.Primary) && - item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops && + if (item.HasImage(ImageType.Primary) && + item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MovieOptions.MaxBackdrops && !item.LockedFields.Contains(MetadataFields.Images)) { return false; @@ -211,10 +211,10 @@ namespace MediaBrowser.Providers.Movies cancellationToken.ThrowIfCancellationRequested(); var eligibleBackdrops = images - .Where(i => i.Type == ImageType.Backdrop && i.Width.HasValue && i.Width.Value >= ConfigurationManager.Configuration.MinMovieBackdropDownloadWidth) + .Where(i => i.Type == ImageType.Backdrop && i.Width.HasValue && i.Width.Value >= ConfigurationManager.Configuration.MovieOptions.MinBackdropWidth) .ToList(); - var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops; + var backdropLimit = ConfigurationManager.Configuration.MovieOptions.MaxBackdrops; // backdrops - only download if earlier providers didn't find any (fanart) if (eligibleBackdrops.Count > 0 && diff --git a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs index 454d56daf..b248fcb40 100644 --- a/MediaBrowser.Providers/Music/FanArtArtistProvider.cs +++ b/MediaBrowser.Providers/Music/FanArtArtistProvider.cs @@ -302,7 +302,7 @@ namespace MediaBrowser.Providers.Music { cancellationToken.ThrowIfCancellationRequested(); - var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops; + var backdropLimit = ConfigurationManager.Configuration.MusicOptions.MaxBackdrops; if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit) { diff --git a/MediaBrowser.Providers/TV/FanArtTVProvider.cs b/MediaBrowser.Providers/TV/FanArtTVProvider.cs index d939951fb..286702b8c 100644 --- a/MediaBrowser.Providers/TV/FanArtTVProvider.cs +++ b/MediaBrowser.Providers/TV/FanArtTVProvider.cs @@ -238,7 +238,7 @@ namespace MediaBrowser.Providers.TV { cancellationToken.ThrowIfCancellationRequested(); - var backdropLimit = ConfigurationManager.Configuration.MaxBackdrops; + var backdropLimit = ConfigurationManager.Configuration.TvOptions.MaxBackdrops; if (ConfigurationManager.Configuration.DownloadSeriesImages.Backdrops && item.BackdropImagePaths.Count < backdropLimit) { diff --git a/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs b/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs index 9220b8fa0..21a72dd57 100644 --- a/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs +++ b/MediaBrowser.Providers/TV/TvdbSeriesImageProvider.cs @@ -137,7 +137,7 @@ namespace MediaBrowser.Providers.TV protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo) { - if (item.HasImage(ImageType.Primary) && item.HasImage(ImageType.Banner) && item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops) + if (item.HasImage(ImageType.Primary) && item.HasImage(ImageType.Banner) && item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.TvOptions.MaxBackdrops) { return false; } @@ -196,7 +196,7 @@ namespace MediaBrowser.Providers.TV { foreach (var backdrop in images.Where(i => i.Type == ImageType.Backdrop && (!i.Width.HasValue || - i.Width.Value >= ConfigurationManager.Configuration.MinSeriesBackdropDownloadWidth))) + i.Width.Value >= ConfigurationManager.Configuration.TvOptions.MinBackdropWidth))) { var url = backdrop.Url; diff --git a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs index 7ce0cad73..7ddf63cf8 100644 --- a/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs +++ b/MediaBrowser.Server.Implementations/Drawing/ImageProcessor.cs @@ -228,17 +228,12 @@ namespace MediaBrowser.Server.Implementations.Drawing // Graphics.FromImage will throw an exception if the PixelFormat is Indexed, so we need to handle that here using (var thumbnail = new Bitmap(newWidth, newHeight, PixelFormat.Format32bppPArgb)) { - #if __MonoCS__ // Mono throw an exeception if assign 0 to SetResolution - if (originalImage.HorizontalResolution != 0 && originalImage.VerticalResolution != 0) + if (originalImage.HorizontalResolution >= 0 && originalImage.VerticalResolution >= 0) { // Preserve the original resolution thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution); } - #else - // Preserve the original resolution - thumbnail.SetResolution(originalImage.HorizontalResolution, originalImage.VerticalResolution); - #endif using (var thumbnailGraph = Graphics.FromImage(thumbnail)) { diff --git a/MediaBrowser.WebDashboard/Api/DashboardService.cs b/MediaBrowser.WebDashboard/Api/DashboardService.cs index e68abd23e..8c775fc15 100644 --- a/MediaBrowser.WebDashboard/Api/DashboardService.cs +++ b/MediaBrowser.WebDashboard/Api/DashboardService.cs @@ -472,7 +472,7 @@ namespace MediaBrowser.WebDashboard.Api "alphapicker.js", "addpluginpage.js", "advancedconfigurationpage.js", - "advancedmetadataconfigurationpage.js", + "metadataadvanced.js", "boxsets.js", "appsplayback.js", "appsweather.js", @@ -510,7 +510,6 @@ namespace MediaBrowser.WebDashboard.Api "mediaplayer.js", "metadataconfigurationpage.js", "metadataimagespage.js", - "metadataimageextraction.js", "moviegenres.js", "movies.js", "moviepeople.js", diff --git a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj index d441abfeb..3ae7e7f1d 100644 --- a/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj +++ b/MediaBrowser.WebDashboard/MediaBrowser.WebDashboard.csproj @@ -154,9 +154,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -436,9 +433,6 @@ PreserveNewest - - PreserveNewest - PreserveNewest @@ -1531,12 +1525,12 @@ - + PreserveNewest - + PreserveNewest -- cgit v1.2.3