The Free Software Media System - Server Backend & API
Refactor art download options (still need config changes)
Eric Reedb7a6a1d5740e
diff --git a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.csindex d307fe0990..9c71642e99 100644--- a/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs+++ b/MediaBrowser.Controller/Providers/Movies/FanArtMovieProvider.cs@@ -91,9 +91,9 @@ namespace MediaBrowser.Controller.Providers.Moviesvar logoExists = item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE);var discExists = item.ResolveArgs.ContainsMetaFileByName(DISC_FILE);- return (!artExists && ConfigurationManager.Configuration.DownloadMovieArt)- || (!logoExists && ConfigurationManager.Configuration.DownloadMovieLogo)- || (!discExists && ConfigurationManager.Configuration.DownloadMovieDisc);+ return (!artExists && ConfigurationManager.Configuration.DownloadMovieImages.Art)+ || (!logoExists && ConfigurationManager.Configuration.DownloadMovieImages.Logo)+ || (!discExists && ConfigurationManager.Configuration.DownloadMovieImages.Disc);}/// <summary>@@ -131,7 +131,7 @@ namespace MediaBrowser.Controller.Providers.Movies{string path;var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";- if (ConfigurationManager.Configuration.DownloadMovieLogo && !item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE))+ if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE)){var node =doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo[@lang = \"" + language + "\"]/@url") ??@@ -160,7 +160,7 @@ namespace MediaBrowser.Controller.Providers.Movies}cancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadMovieArt && !item.ResolveArgs.ContainsMetaFileByName(ART_FILE))+ if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !item.ResolveArgs.ContainsMetaFileByName(ART_FILE)){var node =doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart[@lang = \"" + language + "\"]/@url") ??@@ -186,7 +186,7 @@ namespace MediaBrowser.Controller.Providers.Movies}cancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadMovieDisc && !item.ResolveArgs.ContainsMetaFileByName(DISC_FILE))+ if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !item.ResolveArgs.ContainsMetaFileByName(DISC_FILE)){var node = doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc[@lang = \"" + language + "\"]/@url") ??doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc/@url");@@ -210,7 +210,7 @@ namespace MediaBrowser.Controller.Providers.MoviescancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadMovieBanner && !item.ResolveArgs.ContainsMetaFileByName(BANNER_FILE))+ if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !item.ResolveArgs.ContainsMetaFileByName(BANNER_FILE)){var node = doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner[@lang = \"" + language + "\"]/@url") ??doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner/@url");@@ -234,7 +234,7 @@ namespace MediaBrowser.Controller.Providers.MoviescancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadMovieThumb && !item.ResolveArgs.ContainsMetaFileByName(THUMB_FILE))+ if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !item.ResolveArgs.ContainsMetaFileByName(THUMB_FILE)){var node = doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb[@lang = \"" + language + "\"]/@url") ??doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb/@url");diff --git a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.csindex d4585d58ae..9f0dedf4db 100644--- a/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs+++ b/MediaBrowser.Controller/Providers/Music/FanArtArtistProvider.cs@@ -66,9 +66,9 @@ namespace MediaBrowser.Controller.Providers.Musicvar logoExists = item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE);var discExists = item.ResolveArgs.ContainsMetaFileByName(DISC_FILE);- return (!artExists && ConfigurationManager.Configuration.DownloadMovieArt)- || (!logoExists && ConfigurationManager.Configuration.DownloadMovieLogo)- || (!discExists && ConfigurationManager.Configuration.DownloadMovieDisc);+ return (!artExists && ConfigurationManager.Configuration.DownloadMusicArtistImages.Art)+ || (!logoExists && ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo)+ || (!discExists && ConfigurationManager.Configuration.DownloadMusicArtistImages.Disc);}/// <summary>@@ -105,7 +105,7 @@ namespace MediaBrowser.Controller.Providers.Music{string path;var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";- if (ConfigurationManager.Configuration.DownloadMovieLogo && !item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE))+ if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.ResolveArgs.ContainsMetaFileByName(LOGO_FILE)){var node =doc.SelectSingleNode("//fanart/music/musiclogos/" + hd + "musiclogo/@url") ??@@ -129,7 +129,7 @@ namespace MediaBrowser.Controller.Providers.Music}cancellationToken.ThrowIfCancellationRequested();- if (!item.ResolveArgs.ContainsMetaFileByName(BACKDROP_FILE))+ if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && !item.ResolveArgs.ContainsMetaFileByName(BACKDROP_FILE)){var nodes = doc.SelectNodes("//fanart/music/artistbackgrounds//@url");if (nodes != null)@@ -163,7 +163,7 @@ namespace MediaBrowser.Controller.Providers.MusiccancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadMovieArt && !item.ResolveArgs.ContainsMetaFileByName(ART_FILE))+ if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.ResolveArgs.ContainsMetaFileByName(ART_FILE)){var node =doc.SelectSingleNode("//fanart/music/musicarts/" + hd + "musicart/@url") ??@@ -187,7 +187,7 @@ namespace MediaBrowser.Controller.Providers.Music}cancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadMovieBanner && !item.ResolveArgs.ContainsMetaFileByName(BANNER_FILE))+ if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.ResolveArgs.ContainsMetaFileByName(BANNER_FILE)){var node = doc.SelectSingleNode("//fanart/music/musicbanners/"+hd+"musicbanner/@url") ??doc.SelectSingleNode("//fanart/music/musicbanners/musicbanner/@url");@@ -212,7 +212,7 @@ namespace MediaBrowser.Controller.Providers.MusiccancellationToken.ThrowIfCancellationRequested();// Artist thumbs are actually primary images (they are square/portrait)- if (!item.ResolveArgs.ContainsMetaFileByName(PRIMARY_FILE))+ if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.ResolveArgs.ContainsMetaFileByName(PRIMARY_FILE)){var node = doc.SelectSingleNode("//fanart/music/artistthumbs/artistthumb/@url");path = node != null ? node.Value : null;diff --git a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.csindex d89545a8d1..5dcead7b1a 100644--- a/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs+++ b/MediaBrowser.Controller/Providers/TV/FanArtTVProvider.cs@@ -48,9 +48,9 @@ namespace MediaBrowser.Controller.Providers.TVvar thumbExists = item.ResolveArgs.ContainsMetaFileByName(THUMB_FILE);- return (!artExists && ConfigurationManager.Configuration.DownloadTVArt)- || (!logoExists && ConfigurationManager.Configuration.DownloadTVLogo)- || (!thumbExists && ConfigurationManager.Configuration.DownloadTVThumb);+ return (!artExists && ConfigurationManager.Configuration.DownloadSeriesImages.Art)+ || (!logoExists && ConfigurationManager.Configuration.DownloadSeriesImages.Logo)+ || (!thumbExists && ConfigurationManager.Configuration.DownloadSeriesImages.Thumb);}protected override async Task<bool> FetchAsyncInternal(BaseItem item, bool force, CancellationToken cancellationToken)@@ -80,7 +80,7 @@ namespace MediaBrowser.Controller.Providers.TVif (doc.HasChildNodes){string path;- if (ConfigurationManager.Configuration.DownloadTVLogo && !series.ResolveArgs.ContainsMetaFileByName(LOGO_FILE))+ if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !series.ResolveArgs.ContainsMetaFileByName(LOGO_FILE)){var node = doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo[@lang = \"" + language + "\"]/@url") ??doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo/@url");@@ -104,7 +104,7 @@ namespace MediaBrowser.Controller.Providers.TVcancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadTVArt && !series.ResolveArgs.ContainsMetaFileByName(ART_FILE))+ if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !series.ResolveArgs.ContainsMetaFileByName(ART_FILE)){var node = doc.SelectSingleNode("//fanart/series/cleararts/clearart[@lang = \"" + language + "\"]/@url") ??doc.SelectSingleNode("//fanart/series/cleararts/clearart/@url");@@ -128,7 +128,7 @@ namespace MediaBrowser.Controller.Providers.TVcancellationToken.ThrowIfCancellationRequested();- if (ConfigurationManager.Configuration.DownloadTVThumb && !series.ResolveArgs.ContainsMetaFileByName(THUMB_FILE))+ if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !series.ResolveArgs.ContainsMetaFileByName(THUMB_FILE)){var node = doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb[@lang = \"" + language + "\"]/@url") ??doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb/@url");diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.csindex 71741d2259..03d7d3353d 100644--- a/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs+++ b/MediaBrowser.Controller/Providers/TV/RemoteSeasonProvider.cs@@ -186,7 +186,7 @@ namespace MediaBrowser.Controller.Providers.TV}}- if (ConfigurationManager.Configuration.DownloadTVSeasonBanner && (ConfigurationManager.Configuration.RefreshItemImages || !season.HasLocalImage("banner")))+ if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && (ConfigurationManager.Configuration.RefreshItemImages || !season.HasLocalImage("banner"))){var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "']");if (n != null)@@ -218,7 +218,7 @@ namespace MediaBrowser.Controller.Providers.TV}}- if (ConfigurationManager.Configuration.DownloadTVSeasonBackdrops && (ConfigurationManager.Configuration.RefreshItemImages || !season.HasLocalImage("backdrop")))+ if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && (ConfigurationManager.Configuration.RefreshItemImages || !season.HasLocalImage("backdrop"))){var n = images.SelectSingleNode("//Banner[BannerType='fanart'][Season='" + seasonNumber + "']");if (n != null)diff --git a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.csindex 1d4063cdde..efb158b1e9 100644--- a/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs+++ b/MediaBrowser.Controller/Providers/TV/RemoteSeriesProvider.cs@@ -379,7 +379,7 @@ namespace MediaBrowser.Controller.Providers.TV}}- if (ConfigurationManager.Configuration.DownloadTVBanner && (ConfigurationManager.Configuration.RefreshItemImages || !series.HasLocalImage("banner")))+ if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && (ConfigurationManager.Configuration.RefreshItemImages || !series.HasLocalImage("banner"))){var n = images.SelectSingleNode("//Banner[BannerType='series']");if (n != null)diff --git a/MediaBrowser.Model/Configuration/ServerConfiguration.cs b/MediaBrowser.Model/Configuration/ServerConfiguration.csindex 71f368397b..5930920fb7 100644--- a/MediaBrowser.Model/Configuration/ServerConfiguration.cs+++ b/MediaBrowser.Model/Configuration/ServerConfiguration.cs@@ -1,4 +1,5 @@-using MediaBrowser.Model.Updates;+using MediaBrowser.Model.Entities;+using MediaBrowser.Model.Updates;using MediaBrowser.Model.Weather;using ProtoBuf;using System;@@ -96,88 +97,34 @@ namespace MediaBrowser.Model.Configurationpublic int MaxBackdrops { get; set; }/// <summary>- /// Gets or sets a value indicating whether [download movie art].+ /// Options for specific art to download for movies./// </summary>- /// <value><c>true</c> if [download movie art]; otherwise, <c>false</c>.</value>[ProtoMember(40)]- public bool DownloadMovieArt { get; set; }+ public ImageDownloadOptions DownloadMovieImages { get; set; }/// <summary>- /// Gets or sets a value indicating whether [download movie logo].+ /// Options for specific art to download for Series./// </summary>- /// <value><c>true</c> if [download movie logo]; otherwise, <c>false</c>.</value>[ProtoMember(41)]- public bool DownloadMovieLogo { get; set; }+ public ImageDownloadOptions DownloadSeriesImages { get; set; }/// <summary>- /// Gets or sets a value indicating whether [download movie disc].+ /// Options for specific art to download for Seasons./// </summary>- /// <value><c>true</c> if [download movie disc]; otherwise, <c>false</c>.</value>[ProtoMember(42)]- public bool DownloadMovieDisc { get; set; }+ public ImageDownloadOptions DownloadSeasonImages { get; set; }/// <summary>- /// Gets or sets a value indicating whether [download TV art].+ /// Options for specific art to download for MusicArtists./// </summary>- /// <value><c>true</c> if [download TV art]; otherwise, <c>false</c>.</value>[ProtoMember(43)]- public bool DownloadTVArt { get; set; }+ public ImageDownloadOptions DownloadMusicArtistImages { get; set; }/// <summary>- /// Gets or sets a value indicating whether [download TV logo].+ /// Options for specific art to download for MusicAlbums./// </summary>- /// <value><c>true</c> if [download TV logo]; otherwise, <c>false</c>.</value>[ProtoMember(44)]- public bool DownloadTVLogo { get; set; }-- /// <summary>- /// Gets or sets a value indicating whether [download TV thumb].- /// </summary>- /// <value><c>true</c> if [download TV thumb]; otherwise, <c>false</c>.</value>- [ProtoMember(45)]- public bool DownloadTVThumb { get; set; }-- /// <summary>- /// Gets or sets a value indicating whether [download movie banner].- /// </summary>- /// <value><c>true</c> if [download movie banner]; otherwise, <c>false</c>.</value>- [ProtoMember(46)]- public bool DownloadMovieBanner { get; set; }-- /// <summary>- /// Gets or sets a value indicating whether [download movie thumb].- /// </summary>- /// <value><c>true</c> if [download movie thumb]; otherwise, <c>false</c>.</value>- [ProtoMember(47)]- public bool DownloadMovieThumb { get; set; }-- /// <summary>- /// Gets or sets a value indicating whether [download TV banner].- /// </summary>- /// <value><c>true</c> if [download TV banner]; otherwise, <c>false</c>.</value>- [ProtoMember(48)]- public bool DownloadTVBanner { get; set; }-- /// <summary>- /// Gets or sets a value indicating whether [download TV season banner].- /// </summary>- /// <value><c>true</c> if [download TV season banner]; otherwise, <c>false</c>.</value>- [ProtoMember(49)]- public bool DownloadTVSeasonBanner { get; set; }-- /// <summary>- /// Gets or sets a value indicating whether [download TV season thumb].- /// </summary>- /// <value><c>true</c> if [download TV season thumb]; otherwise, <c>false</c>.</value>- [ProtoMember(50)]- public bool DownloadTVSeasonThumb { get; set; }-- /// <summary>- /// Gets or sets a value indicating whether [download TV season backdrops].- /// </summary>- /// <value><c>true</c> if [download TV season banner]; otherwise, <c>false</c>.</value>- [ProtoMember(51)]- public bool DownloadTVSeasonBackdrops { get; set; }+ public ImageDownloadOptions DownloadMusicAlbumImages { get; set; }/// <summary>/// Gets or sets a value indicating whether [download TV season backdrops].@@ -330,8 +277,11 @@ namespace MediaBrowser.Model.ConfigurationTmdbFetchedProfileSize = "w185"; //w185 w45 h632 or originalTmdbFetchedPosterSize = "w500"; //w500, w342, w185 or originalTmdbFetchedBackdropSize = "w1280"; //w1280, w780 or original- DownloadTVSeasonBanner = true;- DownloadTVBanner = true;+ DownloadMovieImages = new ImageDownloadOptions {Backdrops = true, Primary = true};+ DownloadSeriesImages = new ImageDownloadOptions {Backdrops = true, Primary = true, Banner = true, Logo = true};+ DownloadSeasonImages = new ImageDownloadOptions {Backdrops = false, Primary = true, Banner = true};+ DownloadMusicArtistImages = new ImageDownloadOptions {Backdrops = true, Primary = true, Banner = true};+ DownloadMusicAlbumImages = new ImageDownloadOptions {Backdrops = true, Primary = false};DownloadHDFanArt = true;MaxBackdrops = 4;diff --git a/MediaBrowser.Model/MediaBrowser.Model.csproj b/MediaBrowser.Model/MediaBrowser.Model.csprojindex f291e12c9f..0d0e20f815 100644--- a/MediaBrowser.Model/MediaBrowser.Model.csproj+++ b/MediaBrowser.Model/MediaBrowser.Model.csproj@@ -49,6 +49,7 @@<Compile Include="Entities\BaseItemInfo.cs" /><Compile Include="Connectivity\ClientConnectionInfo.cs" /><Compile Include="Connectivity\ClientType.cs" />+ <Compile Include="Entities\ImageDownloadOptions.cs" /><Compile Include="Logging\ILogManager.cs" /><Compile Include="MediaInfo\BlurayDiscInfo.cs" /><Compile Include="Entities\ChapterInfo.cs" />