mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-11-15 18:08:53 -07:00
support tv backdrops from fanart
This commit is contained in:
parent
c702fb2179
commit
2f796d611b
@ -428,17 +428,13 @@ namespace MediaBrowser.Api
|
||||
|
||||
try
|
||||
{
|
||||
await item.RefreshMetadata(CancellationToken.None, forceRefresh: request.Forced).ConfigureAwait(false);
|
||||
|
||||
if (folder != null)
|
||||
{
|
||||
await
|
||||
folder.ValidateChildren(new Progress<double>(), CancellationToken.None, request.Recursive,
|
||||
await folder.ValidateChildren(new Progress<double>(), CancellationToken.None, request.Recursive,
|
||||
request.Forced).ConfigureAwait(false);
|
||||
}
|
||||
else
|
||||
{
|
||||
await
|
||||
item.RefreshMetadata(CancellationToken.None, forceRefresh: request.Forced).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -1,25 +1,15 @@
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace MediaBrowser.Controller.Providers
|
||||
{
|
||||
class FanArtProviderException : ApplicationException
|
||||
{
|
||||
public FanArtProviderException(string msg)
|
||||
: base(msg)
|
||||
{
|
||||
}
|
||||
|
||||
}
|
||||
/// <summary>
|
||||
/// Class FanartBaseProvider
|
||||
/// </summary>
|
||||
public abstract class FanartBaseProvider : BaseMetadataProvider
|
||||
{
|
||||
|
||||
protected static readonly SemaphoreSlim FanArtResourcePool = new SemaphoreSlim(3,3);
|
||||
|
||||
/// <summary>
|
||||
|
@ -84,7 +84,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
return "12";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// The fan art base URL
|
||||
/// </summary>
|
||||
@ -119,7 +119,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!ConfigurationManager.Configuration.DownloadMovieImages.Art &&
|
||||
!ConfigurationManager.Configuration.DownloadMovieImages.Logo &&
|
||||
!ConfigurationManager.Configuration.DownloadMovieImages.Disc &&
|
||||
@ -168,7 +168,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
}
|
||||
|
||||
var status = ProviderRefreshStatus.Success;
|
||||
|
||||
|
||||
var movie = item;
|
||||
|
||||
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
|
||||
@ -192,128 +192,102 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
var saveLocal = ConfigurationManager.Configuration.SaveLocalMeta &&
|
||||
item.LocationType == LocationType.FileSystem;
|
||||
|
||||
if (doc.HasChildNodes)
|
||||
string path;
|
||||
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !item.HasImage(ImageType.Logo))
|
||||
{
|
||||
string path;
|
||||
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
||||
|
||||
var hasLogo = item.LocationType == LocationType.FileSystem ?
|
||||
item.ResolveArgs.ContainsMetaFileByName(LogoFile)
|
||||
: item.HasImage(ImageType.Logo);
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !hasLogo)
|
||||
var node =
|
||||
doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/movielogos/movielogo[@lang = \"" + language + "\"]/@url");
|
||||
if (node == null && language != "en")
|
||||
{
|
||||
var node =
|
||||
doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/movielogos/movielogo[@lang = \"" + language + "\"]/@url");
|
||||
if (node == null && language != "en")
|
||||
{
|
||||
//maybe just couldn't find language - try just first one
|
||||
node = doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo/@url");
|
||||
}
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
movie.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(movie, path, LogoFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
//maybe just couldn't find language - try just first one
|
||||
node = doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo/@url");
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var hasArt = item.LocationType == LocationType.FileSystem ?
|
||||
item.ResolveArgs.ContainsMetaFileByName(ArtFile)
|
||||
: item.HasImage(ImageType.Art);
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !hasArt)
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var node =
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/movieart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/movieart/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
movie.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(movie, path, ArtFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
movie.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(movie, path, LogoFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var hasDisc = item.LocationType == LocationType.FileSystem ?
|
||||
item.ResolveArgs.ContainsMetaFileByName(DiscFile)
|
||||
: item.HasImage(ImageType.Disc);
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !hasDisc)
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !item.HasImage(ImageType.Art))
|
||||
{
|
||||
var node =
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/movieart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviearts/movieart/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
movie.SetImage(ImageType.Disc, await _providerManager.DownloadAndSaveImage(movie, path, DiscFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
movie.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(movie, path, ArtFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var hasBanner = item.LocationType == LocationType.FileSystem ?
|
||||
item.ResolveArgs.ContainsMetaFileByName(BannerFile)
|
||||
: item.HasImage(ImageType.Banner);
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !hasBanner)
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !item.HasImage(ImageType.Disc))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
movie.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(movie, path, BannerFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
movie.SetImage(ImageType.Disc, await _providerManager.DownloadAndSaveImage(movie, path, DiscFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var hasThumb = item.LocationType == LocationType.FileSystem ?
|
||||
item.ResolveArgs.ContainsMetaFileByName(ThumbFile)
|
||||
: item.HasImage(ImageType.Thumb);
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !hasThumb)
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !item.HasImage(ImageType.Banner))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
movie.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(movie, path, ThumbFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
movie.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(movie, path, BannerFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
var hasBackdrop = item.LocationType == LocationType.FileSystem ?
|
||||
item.ResolveArgs.ContainsMetaFileByName(BackdropFile)
|
||||
: item.BackdropImagePaths.Count > 0;
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && !hasBackdrop)
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !item.HasImage(ImageType.Thumb))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var nodes = doc.SelectNodes("//fanart/movie/moviebackgrounds//@url");
|
||||
if (nodes != null)
|
||||
movie.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(movie, path, ThumbFile, saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count < ConfigurationManager.Configuration.MaxBackdrops)
|
||||
{
|
||||
var nodes = doc.SelectNodes("//fanart/movie/moviebackgrounds//@url");
|
||||
|
||||
if (nodes != null)
|
||||
{
|
||||
var numBackdrops = item.BackdropImagePaths.Count;
|
||||
|
||||
foreach (XmlNode node in nodes)
|
||||
{
|
||||
var numBackdrops = 0;
|
||||
item.BackdropImagePaths = new List<string>();
|
||||
foreach (XmlNode node in nodes)
|
||||
path = node.Value;
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
path = node.Value;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting Backdrop for " + item.Name);
|
||||
item.BackdropImagePaths.Add(await _providerManager.DownloadAndSaveImage(item, path, ("backdrop" + (numBackdrops > 0 ? numBackdrops.ToString(UsCulture) : "") + ".jpg"), saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
numBackdrops++;
|
||||
if (numBackdrops >= ConfigurationManager.Configuration.MaxBackdrops) break;
|
||||
}
|
||||
}
|
||||
item.BackdropImagePaths.Add(await _providerManager.DownloadAndSaveImage(item, path, ("backdrop" + (numBackdrops > 0 ? numBackdrops.ToString(UsCulture) : "") + ".jpg"), saveLocal, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
|
||||
numBackdrops++;
|
||||
|
||||
if (item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops) break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Tmdb));
|
||||
|
@ -265,7 +265,7 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
//still nothing - just get first one
|
||||
profile = searchResult.profiles[0];
|
||||
}
|
||||
if (profile != null)
|
||||
if (profile != null && !person.HasImage(ImageType.Primary))
|
||||
{
|
||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
@ -299,20 +299,19 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||
|
||||
//download and save locally (if not already there)
|
||||
var localPath = Path.Combine(item.MetaLocation, targetName);
|
||||
if (!item.ResolveArgs.ContainsMetaFileByName(targetName))
|
||||
|
||||
using (var sourceStream = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
using (var sourceStream = await MovieDbProvider.Current.GetMovieDbResponse(new HttpRequestOptions
|
||||
{
|
||||
Url = source,
|
||||
CancellationToken = cancellationToken
|
||||
Url = source,
|
||||
CancellationToken = cancellationToken
|
||||
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
await ProviderManager.SaveToLibraryFilesystem(item, localPath, sourceStream, cancellationToken).ConfigureAwait(false);
|
||||
}).ConfigureAwait(false))
|
||||
{
|
||||
await ProviderManager.SaveToLibraryFilesystem(item, localPath, sourceStream, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
Logger.Debug("TmdbPersonProvider downloaded and saved image for {0}", item.Name);
|
||||
}
|
||||
Logger.Debug("TmdbPersonProvider downloaded and saved image for {0}", item.Name);
|
||||
}
|
||||
|
||||
return localPath;
|
||||
}
|
||||
|
||||
|
@ -1,11 +1,11 @@
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Entities.TV;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using MediaBrowser.Model.Net;
|
||||
using System;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -53,7 +53,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
if (!ConfigurationManager.Configuration.DownloadSeriesImages.Art &&
|
||||
!ConfigurationManager.Configuration.DownloadSeriesImages.Logo &&
|
||||
!ConfigurationManager.Configuration.DownloadSeriesImages.Thumb &&
|
||||
@ -79,6 +79,8 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
{
|
||||
return string.IsNullOrEmpty(id) ? Guid.Empty : id.GetMD5();
|
||||
}
|
||||
|
||||
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||
|
||||
public override async Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
|
||||
{
|
||||
@ -92,7 +94,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
data = new BaseProviderInfo();
|
||||
item.ProviderData[Id] = data;
|
||||
}
|
||||
|
||||
|
||||
var series = (Series)item;
|
||||
|
||||
string language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
|
||||
@ -113,68 +115,91 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (doc.HasChildNodes)
|
||||
string path;
|
||||
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear";
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !series.HasImage(ImageType.Logo))
|
||||
{
|
||||
string path;
|
||||
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear";
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !series.ResolveArgs.ContainsMetaFileByName(LogoFile))
|
||||
var node = doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/clearlogos/clearlogo/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting ClearLogo for " + series.Name);
|
||||
series.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(series, path, LogoFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !series.ResolveArgs.ContainsMetaFileByName(ArtFile))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/cleararts/clearart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/cleararts/clearart/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting ClearArt for " + series.Name);
|
||||
series.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(series, path, ArtFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !series.ResolveArgs.ContainsMetaFileByName(ThumbFile))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting ThumbArt for " + series.Name);
|
||||
series.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(series, path, ThumbFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.ResolveArgs.ContainsMetaFileByName(BannerFile))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting banner for " + series.Name);
|
||||
series.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(series, path, BannerFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
Logger.Debug("FanArtProvider getting ClearLogo for " + series.Name);
|
||||
series.SetImage(ImageType.Logo, await _providerManager.DownloadAndSaveImage(series, path, LogoFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !series.HasImage(ImageType.Art))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/cleararts/clearart[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/cleararts/clearart/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting ClearArt for " + series.Name);
|
||||
series.SetImage(ImageType.Art, await _providerManager.DownloadAndSaveImage(series, path, ArtFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !series.HasImage(ImageType.Thumb))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting ThumbArt for " + series.Name);
|
||||
series.SetImage(ImageType.Thumb, await _providerManager.DownloadAndSaveImage(series, path, ThumbFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner))
|
||||
{
|
||||
var node = doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner[@lang = \"" + language + "\"]/@url") ??
|
||||
doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner/@url");
|
||||
path = node != null ? node.Value : null;
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
Logger.Debug("FanArtProvider getting banner for " + series.Name);
|
||||
series.SetImage(ImageType.Banner, await _providerManager.DownloadAndSaveImage(series, path, BannerFile, ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
}
|
||||
}
|
||||
|
||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count < ConfigurationManager.Configuration.MaxBackdrops)
|
||||
{
|
||||
var nodes = doc.SelectNodes("//fanart/series/showbackgrounds//@url");
|
||||
|
||||
if (nodes != null)
|
||||
{
|
||||
var numBackdrops = item.BackdropImagePaths.Count;
|
||||
|
||||
foreach (XmlNode node in nodes)
|
||||
{
|
||||
path = node.Value;
|
||||
|
||||
if (!string.IsNullOrEmpty(path))
|
||||
{
|
||||
item.BackdropImagePaths.Add(await _providerManager.DownloadAndSaveImage(item, path, ("backdrop" + (numBackdrops > 0 ? numBackdrops.ToString(UsCulture) : "") + ".jpg"), ConfigurationManager.Configuration.SaveLocalMeta, FanArtResourcePool, cancellationToken).ConfigureAwait(false));
|
||||
|
||||
numBackdrops++;
|
||||
|
||||
if (item.BackdropImagePaths.Count >= ConfigurationManager.Configuration.MaxBackdrops) break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Tvdb));
|
||||
SetLastRefreshed(series, DateTime.UtcNow, status);
|
||||
|
||||
|
@ -7,7 +7,6 @@ using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
@ -1,5 +1,4 @@
|
||||
using System.Globalization;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Extensions;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Configuration;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
@ -8,6 +7,7 @@ using MediaBrowser.Controller.Library;
|
||||
using MediaBrowser.Model.Entities;
|
||||
using MediaBrowser.Model.Logging;
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.IO;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
@ -257,6 +257,7 @@ namespace MediaBrowser.Controller.Providers.TV
|
||||
if (series.BackdropImagePaths.Count < ConfigurationManager.Configuration.MaxBackdrops)
|
||||
{
|
||||
var bdNo = series.BackdropImagePaths.Count;
|
||||
|
||||
var xmlNodeList = images.SelectNodes("//Banner[BannerType='fanart']");
|
||||
if (xmlNodeList != null)
|
||||
{
|
||||
|
@ -388,7 +388,7 @@ MediaBrowser.ApiClient = function ($, navigator, JSON, WebSocket, setTimeout) {
|
||||
|
||||
var url = self.getUrl("Items/" + itemId + "/Refresh", {
|
||||
|
||||
force: force || false,
|
||||
forced: force || false,
|
||||
recursive: recursive || false
|
||||
|
||||
});
|
||||
|
@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.117" targetFramework="net45" />
|
||||
<package id="MediaBrowser.ApiClient.Javascript" version="3.0.118" targetFramework="net45" />
|
||||
<package id="ServiceStack.Common" version="3.9.46" targetFramework="net45" />
|
||||
<package id="ServiceStack.Text" version="3.9.45" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user