Refactor art download options (still need config changes)

This commit is contained in:
Eric Reed 2013-03-04 11:09:15 -05:00
parent c1eb5a3b60
commit b7a6a1d574
7 changed files with 43 additions and 92 deletions

View File

@ -91,9 +91,9 @@ namespace MediaBrowser.Controller.Providers.Movies
var 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.Movies
cancellationToken.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.Movies
cancellationToken.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");

View File

@ -66,9 +66,9 @@ namespace MediaBrowser.Controller.Providers.Music
var 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.Music
cancellationToken.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.Music
cancellationToken.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;

View File

@ -48,9 +48,9 @@ namespace MediaBrowser.Controller.Providers.TV
var 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.TV
if (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.TV
cancellationToken.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.TV
cancellationToken.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");

View File

@ -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)

View File

@ -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)

View File

@ -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.Configuration
public 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.Configuration
TmdbFetchedProfileSize = "w185"; //w185 w45 h632 or original
TmdbFetchedPosterSize = "w500"; //w500, w342, w185 or original
TmdbFetchedBackdropSize = "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;

View File

@ -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" />