mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-07-07 10:14:14 -04:00
Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
a8d070d07b
@ -269,12 +269,10 @@ namespace MediaBrowser.Api
|
|||||||
if (request.EnableInternetProviders ?? true)
|
if (request.EnableInternetProviders ?? true)
|
||||||
{
|
{
|
||||||
item.LockedFields = request.LockedFields;
|
item.LockedFields = request.LockedFields;
|
||||||
item.LockedImages = request.LockedImages;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item.LockedFields.Clear();
|
item.LockedFields.Clear();
|
||||||
item.LockedImages.Clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
foreach (var pair in request.ProviderIds.ToList())
|
foreach (var pair in request.ProviderIds.ToList())
|
||||||
|
@ -73,23 +73,23 @@ namespace MediaBrowser.Controller.Drawing
|
|||||||
{
|
{
|
||||||
// http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx
|
// http://msdn.microsoft.com/en-us/library/system.drawing.graphics.fromimage.aspx
|
||||||
|
|
||||||
if (format == PixelFormat.Indexed)
|
if ((format & PixelFormat.Indexed) == PixelFormat.Indexed)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (format == PixelFormat.Undefined)
|
if ((format & PixelFormat.Undefined) == PixelFormat.Undefined)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (format == PixelFormat.DontCare)
|
if ((format & PixelFormat.DontCare) == PixelFormat.DontCare)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (format == PixelFormat.Format16bppArgb1555)
|
if ((format & PixelFormat.Format16bppArgb1555) == PixelFormat.Format16bppArgb1555)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (format == PixelFormat.Format16bppGrayScale)
|
if ((format & PixelFormat.Format16bppGrayScale) == PixelFormat.Format16bppGrayScale)
|
||||||
{
|
{
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -238,7 +238,6 @@ namespace MediaBrowser.Controller.Dto
|
|||||||
if (fields.Contains(ItemFields.MetadataSettings))
|
if (fields.Contains(ItemFields.MetadataSettings))
|
||||||
{
|
{
|
||||||
dto.LockedFields = item.LockedFields;
|
dto.LockedFields = item.LockedFields;
|
||||||
dto.LockedImages = item.LockedImages;
|
|
||||||
dto.EnableInternetProviders = !item.DontFetchMeta;
|
dto.EnableInternetProviders = !item.DontFetchMeta;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
ThemeVideoIds = new List<Guid>();
|
ThemeVideoIds = new List<Guid>();
|
||||||
LocalTrailerIds = new List<Guid>();
|
LocalTrailerIds = new List<Guid>();
|
||||||
LockedFields = new List<MetadataFields>();
|
LockedFields = new List<MetadataFields>();
|
||||||
LockedImages = new List<ImageType>();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -166,12 +165,6 @@ namespace MediaBrowser.Controller.Entities
|
|||||||
/// <value>The locked fields.</value>
|
/// <value>The locked fields.</value>
|
||||||
public List<MetadataFields> LockedFields { get; set; }
|
public List<MetadataFields> LockedFields { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the locked images.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The locked images.</value>
|
|
||||||
public List<ImageType> LockedImages { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Determines whether the item has a saved local image of the specified name (jpg or png).
|
/// Determines whether the item has a saved local image of the specified name (jpg or png).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -3,6 +3,7 @@ using MediaBrowser.Model.Logging;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
namespace MediaBrowser.Controller.IO
|
namespace MediaBrowser.Controller.IO
|
||||||
{
|
{
|
||||||
@ -29,22 +30,29 @@ namespace MediaBrowser.Controller.IO
|
|||||||
throw new ArgumentNullException("path");
|
throw new ArgumentNullException("path");
|
||||||
}
|
}
|
||||||
|
|
||||||
var dict = new Dictionary<string, FileSystemInfo>(StringComparer.OrdinalIgnoreCase);
|
|
||||||
|
|
||||||
var entries = new DirectoryInfo(path).EnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
|
var entries = new DirectoryInfo(path).EnumerateFileSystemInfos(searchPattern, SearchOption.TopDirectoryOnly);
|
||||||
|
|
||||||
|
if (!resolveShortcuts && flattenFolderDepth == 0)
|
||||||
|
{
|
||||||
|
return entries.ToDictionary(i => i.FullName, StringComparer.OrdinalIgnoreCase);
|
||||||
|
}
|
||||||
|
|
||||||
|
var dict = new Dictionary<string, FileSystemInfo>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
foreach (var entry in entries)
|
foreach (var entry in entries)
|
||||||
{
|
{
|
||||||
var isDirectory = (entry.Attributes & FileAttributes.Directory) == FileAttributes.Directory;
|
var isDirectory = (entry.Attributes & FileAttributes.Directory) == FileAttributes.Directory;
|
||||||
|
|
||||||
if (resolveShortcuts && FileSystem.IsShortcut(entry.FullName))
|
var fullName = entry.FullName;
|
||||||
|
|
||||||
|
if (resolveShortcuts && FileSystem.IsShortcut(fullName))
|
||||||
{
|
{
|
||||||
var newPath = FileSystem.ResolveShortcut(entry.FullName);
|
var newPath = FileSystem.ResolveShortcut(fullName);
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(newPath))
|
if (string.IsNullOrWhiteSpace(newPath))
|
||||||
{
|
{
|
||||||
//invalid shortcut - could be old or target could just be unavailable
|
//invalid shortcut - could be old or target could just be unavailable
|
||||||
logger.Warn("Encountered invalid shortcut: " + entry.FullName);
|
logger.Warn("Encountered invalid shortcut: " + fullName);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,18 +65,18 @@ namespace MediaBrowser.Controller.IO
|
|||||||
args.AddAdditionalLocation(newPath);
|
args.AddAdditionalLocation(newPath);
|
||||||
}
|
}
|
||||||
|
|
||||||
dict[data.FullName] = data;
|
dict[newPath] = data;
|
||||||
}
|
}
|
||||||
else if (flattenFolderDepth > 0 && isDirectory)
|
else if (flattenFolderDepth > 0 && isDirectory)
|
||||||
{
|
{
|
||||||
foreach (var child in GetFilteredFileSystemEntries(entry.FullName, logger, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts))
|
foreach (var child in GetFilteredFileSystemEntries(fullName, logger, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts))
|
||||||
{
|
{
|
||||||
dict[child.Key] = child.Value;
|
dict[child.Key] = child.Value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
dict[entry.FullName] = entry;
|
dict[fullName] = entry;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -112,7 +112,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var parentDir = System.IO.Path.GetDirectoryName(FileInfo.FullName) ?? string.Empty;
|
var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty;
|
||||||
|
|
||||||
return (parentDir.Length > _appPaths.RootFolderPath.Length
|
return (parentDir.Length > _appPaths.RootFolderPath.Length
|
||||||
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase));
|
&& parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase));
|
||||||
|
@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Library
|
|||||||
private static bool IsSeasonFolder(string path)
|
private static bool IsSeasonFolder(string path)
|
||||||
{
|
{
|
||||||
// It's a season folder if it's named as such and does not contain any audio files, apart from theme.mp3
|
// It's a season folder if it's named as such and does not contain any audio files, apart from theme.mp3
|
||||||
return GetSeasonNumberFromPath(path) != null && !new DirectoryInfo(path).EnumerateFiles().Any(i => EntityResolutionHelper.IsAudioFile(i.FullName) && !string.Equals(Path.GetFileNameWithoutExtension(i.Name), BaseItem.ThemeSongFilename));
|
return GetSeasonNumberFromPath(path) != null && !Directory.EnumerateFiles(path).Any(i => EntityResolutionHelper.IsAudioFile(i) && !string.Equals(Path.GetFileNameWithoutExtension(i), BaseItem.ThemeSongFilename));
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -223,7 +223,9 @@ namespace MediaBrowser.Controller.Library
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (EntityResolutionHelper.IsVideoFile(child.FullName) && GetEpisodeNumberFromFile(child.FullName, false).HasValue)
|
var fullName = child.FullName;
|
||||||
|
|
||||||
|
if (EntityResolutionHelper.IsVideoFile(fullName) && GetEpisodeNumberFromFile(fullName, false).HasValue)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -470,12 +470,6 @@ namespace MediaBrowser.Model.Dto
|
|||||||
/// <value>The locked fields.</value>
|
/// <value>The locked fields.</value>
|
||||||
public List<MetadataFields> LockedFields { get; set; }
|
public List<MetadataFields> LockedFields { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the locked images.
|
|
||||||
/// </summary>
|
|
||||||
/// <value>The locked images.</value>
|
|
||||||
public List<ImageType> LockedImages { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets a value indicating whether [enable internet providers].
|
/// Gets or sets a value indicating whether [enable internet providers].
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -310,7 +310,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
string path;
|
string path;
|
||||||
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !item.HasImage(ImageType.Logo) && !item.LockedImages.Contains(ImageType.Logo))
|
if (ConfigurationManager.Configuration.DownloadMovieImages.Logo && !item.HasImage(ImageType.Logo))
|
||||||
{
|
{
|
||||||
var node =
|
var node =
|
||||||
doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo[@lang = \"" + language + "\"]/@url") ??
|
doc.SelectSingleNode("//fanart/movie/movielogos/" + hd + "movielogo[@lang = \"" + language + "\"]/@url") ??
|
||||||
@ -328,7 +328,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
}
|
}
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !item.HasImage(ImageType.Art) && !item.LockedImages.Contains(ImageType.Art))
|
if (ConfigurationManager.Configuration.DownloadMovieImages.Art && !item.HasImage(ImageType.Art))
|
||||||
{
|
{
|
||||||
var node =
|
var node =
|
||||||
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart[@lang = \"" + language + "\"]/@url") ??
|
doc.SelectSingleNode("//fanart/movie/moviearts/" + hd + "movieart[@lang = \"" + language + "\"]/@url") ??
|
||||||
@ -343,7 +343,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
}
|
}
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !item.HasImage(ImageType.Disc) && !item.LockedImages.Contains(ImageType.Disc))
|
if (ConfigurationManager.Configuration.DownloadMovieImages.Disc && !item.HasImage(ImageType.Disc))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc[@lang = \"" + language + "\"]/@url") ??
|
var node = doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc[@lang = \"" + language + "\"]/@url") ??
|
||||||
doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc/@url");
|
doc.SelectSingleNode("//fanart/movie/moviediscs/moviedisc/@url");
|
||||||
@ -356,7 +356,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !item.HasImage(ImageType.Banner) && !item.LockedImages.Contains(ImageType.Banner))
|
if (ConfigurationManager.Configuration.DownloadMovieImages.Banner && !item.HasImage(ImageType.Banner))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner[@lang = \"" + language + "\"]/@url") ??
|
var node = doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner[@lang = \"" + language + "\"]/@url") ??
|
||||||
doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner/@url");
|
doc.SelectSingleNode("//fanart/movie/moviebanners/moviebanner/@url");
|
||||||
@ -369,7 +369,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !item.HasImage(ImageType.Thumb) && !item.LockedImages.Contains(ImageType.Thumb))
|
if (ConfigurationManager.Configuration.DownloadMovieImages.Thumb && !item.HasImage(ImageType.Thumb))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb[@lang = \"" + language + "\"]/@url") ??
|
var node = doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb[@lang = \"" + language + "\"]/@url") ??
|
||||||
doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb/@url");
|
doc.SelectSingleNode("//fanart/movie/moviethumbs/moviethumb/@url");
|
||||||
|
@ -134,12 +134,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh if tmdb id has changed
|
|
||||||
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Tmdb)))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Don't refresh if we already have both poster and backdrop and we're not refreshing images
|
// 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 > 0)
|
if (item.HasImage(ImageType.Primary) && item.BackdropImagePaths.Count > 0)
|
||||||
{
|
{
|
||||||
@ -170,21 +164,10 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
var status = await ProcessImages(item, images, cancellationToken).ConfigureAwait(false);
|
var status = await ProcessImages(item, images, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Tmdb));
|
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow, status);
|
SetLastRefreshed(item, DateTime.UtcNow, status);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(string id)
|
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty(id) ? Guid.Empty : id.GetMD5();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Fetches the images.
|
/// Fetches the images.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -220,7 +203,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
var status = ProviderRefreshStatus.Success;
|
var status = ProviderRefreshStatus.Success;
|
||||||
|
|
||||||
// poster
|
// poster
|
||||||
if (images.posters != null && images.posters.Count > 0 && !item.HasImage(ImageType.Primary) && !item.LockedImages.Contains(ImageType.Primary))
|
if (images.posters != null && images.posters.Count > 0 && !item.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
@ -261,7 +244,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
// backdrops - only download if earlier providers didn't find any (fanart)
|
// backdrops - only download if earlier providers didn't find any (fanart)
|
||||||
if (images.backdrops != null && images.backdrops.Count > 0 && ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0 && !item.LockedImages.Contains(ImageType.Backdrop))
|
if (images.backdrops != null && images.backdrops.Count > 0 && ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0)
|
||||||
{
|
{
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -91,16 +91,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
return item is Movie || item is MusicVideo;
|
return item is Movie || item is MusicVideo;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="imdbId">The imdb id.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(string imdbId)
|
|
||||||
{
|
|
||||||
return string.IsNullOrEmpty(imdbId) ? Guid.Empty : imdbId.GetMD5();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets the priority.
|
/// Gets the priority.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -114,23 +104,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Needses the refresh internal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="providerInfo">The provider info.</param>
|
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
|
||||||
{
|
|
||||||
// Refresh if imdb id has changed
|
|
||||||
if (providerInfo.Data != GetComparisonData(item.GetProviderId(MetadataProviders.Imdb)))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
protected readonly CultureInfo UsCulture = new CultureInfo("en-US");
|
||||||
|
|
||||||
public override async Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
|
public override async Task<bool> FetchAsync(BaseItem item, bool force, CancellationToken cancellationToken)
|
||||||
@ -147,7 +120,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
|
|
||||||
if (string.IsNullOrEmpty(imdbId))
|
if (string.IsNullOrEmpty(imdbId))
|
||||||
{
|
{
|
||||||
data.Data = GetComparisonData(imdbId);
|
|
||||||
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -181,7 +153,6 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Data = GetComparisonData(item.GetProviderId(MetadataProviders.Imdb));
|
|
||||||
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
data.LastRefreshStatus = ProviderRefreshStatus.Success;
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
||||||
|
@ -265,7 +265,7 @@ namespace MediaBrowser.Providers.Movies
|
|||||||
//still nothing - just get first one
|
//still nothing - just get first one
|
||||||
profile = searchResult.profiles[0];
|
profile = searchResult.profiles[0];
|
||||||
}
|
}
|
||||||
if (profile != null && !person.HasImage(ImageType.Primary) && !person.LockedImages.Contains(ImageType.Primary))
|
if (profile != null && !person.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
var tmdbSettings = await MovieDbProvider.Current.GetTmdbSettings(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
@ -107,8 +107,11 @@ namespace MediaBrowser.Providers.Music
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
var comparisonData = Guid.Empty;
|
return base.NeedsRefreshInternal(item, providerInfo);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override DateTime CompareDate(BaseItem item)
|
||||||
|
{
|
||||||
var artistMusicBrainzId = item.Parent.GetProviderId(MetadataProviders.Musicbrainz);
|
var artistMusicBrainzId = item.Parent.GetProviderId(MetadataProviders.Musicbrainz);
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(artistMusicBrainzId))
|
if (!string.IsNullOrEmpty(artistMusicBrainzId))
|
||||||
@ -116,25 +119,15 @@ namespace MediaBrowser.Providers.Music
|
|||||||
var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId);
|
var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId);
|
||||||
artistXmlPath = Path.Combine(artistXmlPath, "fanart.xml");
|
artistXmlPath = Path.Combine(artistXmlPath, "fanart.xml");
|
||||||
|
|
||||||
comparisonData = GetComparisonData(new FileInfo(artistXmlPath));
|
var file = new FileInfo(artistXmlPath);
|
||||||
|
|
||||||
|
if (file.Exists)
|
||||||
|
{
|
||||||
|
return file.LastWriteTimeUtc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Refresh anytime the parent mbz id changes
|
return base.CompareDate(item);
|
||||||
if (providerInfo.Data != comparisonData)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(FileInfo artistXmlFileInfo)
|
|
||||||
{
|
|
||||||
return artistXmlFileInfo.Exists ? (artistXmlFileInfo.FullName + artistXmlFileInfo.LastWriteTimeUtc.Ticks).GetMD5() : Guid.Empty;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -158,8 +151,6 @@ namespace MediaBrowser.Providers.Music
|
|||||||
item.ProviderData[Id] = data;
|
item.ProviderData[Id] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
var comparisonData = Guid.Empty;
|
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(artistMusicBrainzId))
|
if (!string.IsNullOrEmpty(artistMusicBrainzId))
|
||||||
{
|
{
|
||||||
var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId);
|
var artistXmlPath = FanArtArtistProvider.GetArtistDataPath(ConfigurationManager.CommonApplicationPaths, artistMusicBrainzId);
|
||||||
@ -167,8 +158,6 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
var artistXmlFileInfo = new FileInfo(artistXmlPath);
|
var artistXmlFileInfo = new FileInfo(artistXmlPath);
|
||||||
|
|
||||||
comparisonData = GetComparisonData(artistXmlFileInfo);
|
|
||||||
|
|
||||||
if (artistXmlFileInfo.Exists)
|
if (artistXmlFileInfo.Exists)
|
||||||
{
|
{
|
||||||
var album = (MusicAlbum)item;
|
var album = (MusicAlbum)item;
|
||||||
@ -187,7 +176,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Disc && !item.HasImage(ImageType.Disc) && !item.LockedImages.Contains(ImageType.Disc))
|
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Disc && !item.HasImage(ImageType.Disc))
|
||||||
{
|
{
|
||||||
// Try try with the release entry Id, if that doesn't produce anything try the release group id
|
// Try try with the release entry Id, if that doesn't produce anything try the release group id
|
||||||
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/cdart/@url");
|
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/cdart/@url");
|
||||||
@ -205,7 +194,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Primary && !item.HasImage(ImageType.Primary) && !item.LockedImages.Contains(ImageType.Primary))
|
if (ConfigurationManager.Configuration.DownloadMusicAlbumImages.Primary && !item.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
// Try try with the release entry Id, if that doesn't produce anything try the release group id
|
// Try try with the release entry Id, if that doesn't produce anything try the release group id
|
||||||
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/albumcover/@url");
|
var node = doc.SelectSingleNode("//fanart/music/albums/album[@id=\"" + releaseEntryId + "\"]/albumcover/@url");
|
||||||
@ -226,7 +215,6 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Data = comparisonData;
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
@ -301,7 +301,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
string path;
|
string path;
|
||||||
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.HasImage(ImageType.Logo) && !item.LockedImages.Contains(ImageType.Logo))
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Logo && !item.HasImage(ImageType.Logo))
|
||||||
{
|
{
|
||||||
var node =
|
var node =
|
||||||
doc.SelectSingleNode("//fanart/music/musiclogos/" + hd + "musiclogo/@url") ??
|
doc.SelectSingleNode("//fanart/music/musiclogos/" + hd + "musiclogo/@url") ??
|
||||||
@ -314,7 +314,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
}
|
}
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && item.BackdropImagePaths.Count == 0 && !item.LockedImages.Contains(ImageType.Backdrop))
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Backdrops && item.BackdropImagePaths.Count == 0)
|
||||||
{
|
{
|
||||||
var nodes = doc.SelectNodes("//fanart/music/artistbackgrounds//@url");
|
var nodes = doc.SelectNodes("//fanart/music/artistbackgrounds//@url");
|
||||||
if (nodes != null)
|
if (nodes != null)
|
||||||
@ -338,7 +338,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.HasImage(ImageType.Art) && !item.LockedImages.Contains(ImageType.Art))
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Art && !item.HasImage(ImageType.Art))
|
||||||
{
|
{
|
||||||
var node =
|
var node =
|
||||||
doc.SelectSingleNode("//fanart/music/musicarts/" + hd + "musicart/@url") ??
|
doc.SelectSingleNode("//fanart/music/musicarts/" + hd + "musicart/@url") ??
|
||||||
@ -351,7 +351,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
}
|
}
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.HasImage(ImageType.Banner) && !item.LockedImages.Contains(ImageType.Banner))
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Banner && !item.HasImage(ImageType.Banner))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/music/musicbanners/" + hd + "musicbanner/@url") ??
|
var node = doc.SelectSingleNode("//fanart/music/musicbanners/" + hd + "musicbanner/@url") ??
|
||||||
doc.SelectSingleNode("//fanart/music/musicbanners/musicbanner/@url");
|
doc.SelectSingleNode("//fanart/music/musicbanners/musicbanner/@url");
|
||||||
@ -365,7 +365,7 @@ namespace MediaBrowser.Providers.Music
|
|||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
// Artist thumbs are actually primary images (they are square/portrait)
|
// Artist thumbs are actually primary images (they are square/portrait)
|
||||||
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.HasImage(ImageType.Primary) && !item.LockedImages.Contains(ImageType.Primary))
|
if (ConfigurationManager.Configuration.DownloadMusicArtistImages.Primary && !item.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/music/artistthumbs/artistthumb/@url");
|
var node = doc.SelectSingleNode("//fanart/music/artistthumbs/artistthumb/@url");
|
||||||
path = node != null ? node.Value : null;
|
path = node != null ? node.Value : null;
|
||||||
|
@ -45,28 +45,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return item is Season;
|
return item is Season;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override DateTime CompareDate(BaseItem item)
|
||||||
/// Needses the refresh internal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="providerInfo">The provider info.</param>
|
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
|
||||||
{
|
|
||||||
if (GetComparisonData(item) != providerInfo.Data)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(BaseItem item)
|
|
||||||
{
|
{
|
||||||
var season = (Season)item;
|
var season = (Season)item;
|
||||||
var seriesId = season.Series != null ? season.Series.GetProviderId(MetadataProviders.Tvdb) : null;
|
var seriesId = season.Series != null ? season.Series.GetProviderId(MetadataProviders.Tvdb) : null;
|
||||||
@ -78,24 +57,13 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
||||||
|
|
||||||
return GetComparisonData(imagesFileInfo);
|
if (imagesFileInfo.Exists)
|
||||||
|
{
|
||||||
|
return imagesFileInfo.LastWriteTimeUtc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Guid.Empty;
|
return base.CompareDate(item);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="imagesFileInfo">The images file info.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(FileInfo imagesFileInfo)
|
|
||||||
{
|
|
||||||
var date = imagesFileInfo.Exists ? imagesFileInfo.LastWriteTimeUtc : DateTime.MinValue;
|
|
||||||
|
|
||||||
var key = date.Ticks + imagesFileInfo.FullName;
|
|
||||||
|
|
||||||
return key.GetMD5();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -138,8 +106,6 @@ namespace MediaBrowser.Providers.TV
|
|||||||
item.ProviderData[Id] = data;
|
item.ProviderData[Id] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Data = GetComparisonData(imagesFileInfo);
|
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -165,7 +131,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
|
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Thumb && !season.HasImage(ImageType.Thumb) && !season.LockedImages.Contains(ImageType.Thumb))
|
if (ConfigurationManager.Configuration.DownloadSeasonImages.Thumb && !season.HasImage(ImageType.Thumb))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/series/seasonthumbs/seasonthumb[@lang = \"" + language + "\"][@season = \"" + seasonNumber + "\"]/@url") ??
|
var node = doc.SelectSingleNode("//fanart/series/seasonthumbs/seasonthumb[@lang = \"" + language + "\"][@season = \"" + seasonNumber + "\"]/@url") ??
|
||||||
doc.SelectSingleNode("//fanart/series/seasonthumbs/seasonthumb[@season = \"" + seasonNumber + "\"]/@url");
|
doc.SelectSingleNode("//fanart/series/seasonthumbs/seasonthumb[@season = \"" + seasonNumber + "\"]/@url");
|
||||||
|
@ -225,7 +225,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
|
var language = ConfigurationManager.Configuration.PreferredMetadataLanguage.ToLower();
|
||||||
|
|
||||||
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear";
|
var hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hdtv" : "clear";
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo) && !item.LockedImages.Contains(ImageType.Logo))
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Logo && !item.HasImage(ImageType.Logo))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/series/" + hd + "logos/" + hd + "logo[@lang = \"" + language + "\"]/@url") ??
|
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/clearlogos/clearlogo[@lang = \"" + language + "\"]/@url") ??
|
||||||
@ -241,7 +241,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
hd = ConfigurationManager.Configuration.DownloadHDFanArt ? "hd" : "";
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art) && !item.LockedImages.Contains(ImageType.Art))
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Art && !item.HasImage(ImageType.Art))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/series/" + hd + "cleararts/" + hd + "clearart[@lang = \"" + language + "\"]/@url") ??
|
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/cleararts/clearart[@lang = \"" + language + "\"]/@url") ??
|
||||||
@ -256,7 +256,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !item.HasImage(ImageType.Thumb) && !item.LockedImages.Contains(ImageType.Thumb))
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Thumb && !item.HasImage(ImageType.Thumb))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb[@lang = \"" + language + "\"]/@url") ??
|
var node = doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb[@lang = \"" + language + "\"]/@url") ??
|
||||||
doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb/@url");
|
doc.SelectSingleNode("//fanart/series/tvthumbs/tvthumb/@url");
|
||||||
@ -267,7 +267,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner) && !item.LockedImages.Contains(ImageType.Banner))
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !item.HasImage(ImageType.Banner))
|
||||||
{
|
{
|
||||||
var node = doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner[@lang = \"" + language + "\"]/@url") ??
|
var node = doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner[@lang = \"" + language + "\"]/@url") ??
|
||||||
doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner/@url");
|
doc.SelectSingleNode("//fanart/series/tbbanners/tvbanner/@url");
|
||||||
@ -278,7 +278,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0 && !item.LockedImages.Contains(ImageType.Backdrop))
|
if (ConfigurationManager.Configuration.DownloadMovieImages.Backdrops && item.BackdropImagePaths.Count == 0)
|
||||||
{
|
{
|
||||||
var nodes = doc.SelectNodes("//fanart/series/showbackgrounds//@url");
|
var nodes = doc.SelectNodes("//fanart/series/showbackgrounds//@url");
|
||||||
|
|
||||||
|
@ -117,20 +117,10 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (GetComparisonData(item) != providerInfo.Data)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
return base.NeedsRefreshInternal(item, providerInfo);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override DateTime CompareDate(BaseItem item)
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(BaseItem item)
|
|
||||||
{
|
{
|
||||||
var episode = (Episode)item;
|
var episode = (Episode)item;
|
||||||
|
|
||||||
@ -143,24 +133,13 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
var seriesXmlFileInfo = new FileInfo(seriesXmlPath);
|
var seriesXmlFileInfo = new FileInfo(seriesXmlPath);
|
||||||
|
|
||||||
return GetComparisonData(seriesXmlFileInfo);
|
if (seriesXmlFileInfo.Exists)
|
||||||
|
{
|
||||||
|
return seriesXmlFileInfo.LastWriteTimeUtc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Guid.Empty;
|
return base.CompareDate(item);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="seriesXmlFileInfo">The series XML file info.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(FileInfo seriesXmlFileInfo)
|
|
||||||
{
|
|
||||||
var date = seriesXmlFileInfo.Exists ? seriesXmlFileInfo.LastWriteTimeUtc : DateTime.MinValue;
|
|
||||||
|
|
||||||
var key = date.Ticks + seriesXmlFileInfo.FullName;
|
|
||||||
|
|
||||||
return key.GetMD5();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -207,8 +186,6 @@ namespace MediaBrowser.Providers.TV
|
|||||||
item.ProviderData[Id] = data;
|
item.ProviderData[Id] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Data = GetComparisonData(seriesXmlFileInfo);
|
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow, status);
|
SetLastRefreshed(item, DateTime.UtcNow, status);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -287,7 +264,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
var doc = new XmlDocument();
|
var doc = new XmlDocument();
|
||||||
doc.LoadXml(episodeNode.OuterXml);
|
doc.LoadXml(episodeNode.OuterXml);
|
||||||
|
|
||||||
if (!episode.HasImage(ImageType.Primary) && !episode.LockedImages.Contains(ImageType.Primary))
|
if (!episode.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
var p = doc.SafeGetString("//filename");
|
var p = doc.SafeGetString("//filename");
|
||||||
if (p != null)
|
if (p != null)
|
||||||
|
@ -1,18 +1,17 @@
|
|||||||
using System.Net;
|
using MediaBrowser.Controller.Configuration;
|
||||||
using MediaBrowser.Common.Extensions;
|
|
||||||
using MediaBrowser.Controller.Configuration;
|
|
||||||
using MediaBrowser.Controller.Entities;
|
using MediaBrowser.Controller.Entities;
|
||||||
using MediaBrowser.Controller.Entities.TV;
|
using MediaBrowser.Controller.Entities.TV;
|
||||||
using MediaBrowser.Controller.Library;
|
using MediaBrowser.Controller.Library;
|
||||||
using MediaBrowser.Controller.Providers;
|
using MediaBrowser.Controller.Providers;
|
||||||
using MediaBrowser.Model.Entities;
|
using MediaBrowser.Model.Entities;
|
||||||
using MediaBrowser.Model.Logging;
|
using MediaBrowser.Model.Logging;
|
||||||
|
using MediaBrowser.Model.Net;
|
||||||
using System;
|
using System;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
|
using System.Net;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Xml;
|
using System.Xml;
|
||||||
using MediaBrowser.Model.Net;
|
|
||||||
|
|
||||||
namespace MediaBrowser.Providers.TV
|
namespace MediaBrowser.Providers.TV
|
||||||
{
|
{
|
||||||
@ -95,28 +94,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override DateTime CompareDate(BaseItem item)
|
||||||
/// Needses the refresh internal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="providerInfo">The provider info.</param>
|
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
|
||||||
{
|
|
||||||
if (GetComparisonData(item) != providerInfo.Data)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(BaseItem item)
|
|
||||||
{
|
{
|
||||||
var season = (Season)item;
|
var season = (Season)item;
|
||||||
var seriesId = season.Series != null ? season.Series.GetProviderId(MetadataProviders.Tvdb) : null;
|
var seriesId = season.Series != null ? season.Series.GetProviderId(MetadataProviders.Tvdb) : null;
|
||||||
@ -128,24 +106,13 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
||||||
|
|
||||||
return GetComparisonData(imagesFileInfo);
|
if (imagesFileInfo.Exists)
|
||||||
|
{
|
||||||
|
return imagesFileInfo.LastWriteTimeUtc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Guid.Empty;
|
return base.CompareDate(item);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="imagesFileInfo">The images file info.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(FileInfo imagesFileInfo)
|
|
||||||
{
|
|
||||||
var date = imagesFileInfo.Exists ? imagesFileInfo.LastWriteTimeUtc : DateTime.MinValue;
|
|
||||||
|
|
||||||
var key = date.Ticks + imagesFileInfo.FullName;
|
|
||||||
|
|
||||||
return key.GetMD5();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -181,15 +148,6 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BaseProviderInfo data;
|
|
||||||
if (!item.ProviderData.TryGetValue(Id, out data))
|
|
||||||
{
|
|
||||||
data = new BaseProviderInfo();
|
|
||||||
item.ProviderData[Id] = data;
|
|
||||||
}
|
|
||||||
|
|
||||||
data.Data = GetComparisonData(imagesFileInfo);
|
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -213,7 +171,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!season.HasImage(ImageType.Primary) && !season.LockedImages.Contains(ImageType.Primary))
|
if (!season.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
|
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
|
||||||
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='en']");
|
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='season'][Season='" + seasonNumber + "'][Language='en']");
|
||||||
@ -226,7 +184,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && !season.HasImage(ImageType.Banner) && !season.LockedImages.Contains(ImageType.Banner))
|
if (ConfigurationManager.Configuration.DownloadSeasonImages.Banner && !season.HasImage(ImageType.Banner))
|
||||||
{
|
{
|
||||||
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
|
var n = images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='" + ConfigurationManager.Configuration.PreferredMetadataLanguage + "']") ??
|
||||||
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='en']");
|
images.SelectSingleNode("//Banner[BannerType='season'][BannerType2='seasonwide'][Season='" + seasonNumber + "'][Language='en']");
|
||||||
@ -261,7 +219,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && season.BackdropImagePaths.Count == 0 && !season.LockedImages.Contains(ImageType.Backdrop))
|
if (ConfigurationManager.Configuration.DownloadSeasonImages.Backdrops && season.BackdropImagePaths.Count == 0)
|
||||||
{
|
{
|
||||||
var n = images.SelectSingleNode("//Banner[BannerType='fanart'][Season='" + seasonNumber + "']");
|
var n = images.SelectSingleNode("//Banner[BannerType='fanart'][Season='" + seasonNumber + "']");
|
||||||
if (n != null)
|
if (n != null)
|
||||||
|
@ -104,28 +104,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
protected override DateTime CompareDate(BaseItem item)
|
||||||
/// Needses the refresh internal.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <param name="providerInfo">The provider info.</param>
|
|
||||||
/// <returns><c>true</c> if XXXX, <c>false</c> otherwise</returns>
|
|
||||||
protected override bool NeedsRefreshInternal(BaseItem item, BaseProviderInfo providerInfo)
|
|
||||||
{
|
|
||||||
if (GetComparisonData(item) != providerInfo.Data)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.NeedsRefreshInternal(item, providerInfo);
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="item">The item.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(BaseItem item)
|
|
||||||
{
|
{
|
||||||
var seriesId = item.GetProviderId(MetadataProviders.Tvdb);
|
var seriesId = item.GetProviderId(MetadataProviders.Tvdb);
|
||||||
|
|
||||||
@ -136,24 +115,13 @@ namespace MediaBrowser.Providers.TV
|
|||||||
|
|
||||||
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
var imagesFileInfo = new FileInfo(imagesXmlPath);
|
||||||
|
|
||||||
return GetComparisonData(imagesFileInfo);
|
if (imagesFileInfo.Exists)
|
||||||
|
{
|
||||||
|
return imagesFileInfo.LastWriteTimeUtc;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return Guid.Empty;
|
return base.CompareDate(item);
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets the comparison data.
|
|
||||||
/// </summary>
|
|
||||||
/// <param name="imagesFileInfo">The images file info.</param>
|
|
||||||
/// <returns>Guid.</returns>
|
|
||||||
private Guid GetComparisonData(FileInfo imagesFileInfo)
|
|
||||||
{
|
|
||||||
var date = imagesFileInfo.Exists ? imagesFileInfo.LastWriteTimeUtc : DateTime.MinValue;
|
|
||||||
|
|
||||||
var key = date.Ticks + imagesFileInfo.FullName;
|
|
||||||
|
|
||||||
return key.GetMD5();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -195,8 +163,6 @@ namespace MediaBrowser.Providers.TV
|
|||||||
item.ProviderData[Id] = data;
|
item.ProviderData[Id] = data;
|
||||||
}
|
}
|
||||||
|
|
||||||
data.Data = GetComparisonData(imagesFileInfo);
|
|
||||||
|
|
||||||
SetLastRefreshed(item, DateTime.UtcNow);
|
SetLastRefreshed(item, DateTime.UtcNow);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@ -215,7 +181,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
private async Task FetchImages(Series series, XmlDocument images, CancellationToken cancellationToken)
|
private async Task FetchImages(Series series, XmlDocument images, CancellationToken cancellationToken)
|
||||||
{
|
{
|
||||||
if (!series.HasImage(ImageType.Primary) && !series.LockedImages.Contains(ImageType.Primary))
|
if (!series.HasImage(ImageType.Primary))
|
||||||
{
|
{
|
||||||
var n = images.SelectSingleNode("//Banner[BannerType='poster']");
|
var n = images.SelectSingleNode("//Banner[BannerType='poster']");
|
||||||
if (n != null)
|
if (n != null)
|
||||||
@ -230,7 +196,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner) && !series.LockedImages.Contains(ImageType.Banner))
|
if (ConfigurationManager.Configuration.DownloadSeriesImages.Banner && !series.HasImage(ImageType.Banner))
|
||||||
{
|
{
|
||||||
var n = images.SelectSingleNode("//Banner[BannerType='series']");
|
var n = images.SelectSingleNode("//Banner[BannerType='series']");
|
||||||
if (n != null)
|
if (n != null)
|
||||||
@ -245,7 +211,7 @@ namespace MediaBrowser.Providers.TV
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (series.BackdropImagePaths.Count == 0 && !series.LockedImages.Contains(ImageType.Backdrop))
|
if (series.BackdropImagePaths.Count == 0)
|
||||||
{
|
{
|
||||||
var bdNo = series.BackdropImagePaths.Count;
|
var bdNo = series.BackdropImagePaths.Count;
|
||||||
|
|
||||||
|
@ -53,7 +53,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||||||
// If list contains at least 2 audio files or at least one and no video files consider it to contain music
|
// If list contains at least 2 audio files or at least one and no video files consider it to contain music
|
||||||
var foundAudio = 0;
|
var foundAudio = 0;
|
||||||
|
|
||||||
foreach (var fullName in new DirectoryInfo(path).EnumerateFiles().Select(file => file.FullName))
|
foreach (var fullName in Directory.EnumerateFiles(path))
|
||||||
{
|
{
|
||||||
if (EntityResolutionHelper.IsAudioFile(fullName)) foundAudio++;
|
if (EntityResolutionHelper.IsAudioFile(fullName)) foundAudio++;
|
||||||
if (foundAudio >= 2)
|
if (foundAudio >= 2)
|
||||||
@ -95,14 +95,14 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
|
|||||||
// If list contains at least 2 audio files or at least one and no video files consider it to contain music
|
// If list contains at least 2 audio files or at least one and no video files consider it to contain music
|
||||||
var foundAudio = 0;
|
var foundAudio = 0;
|
||||||
|
|
||||||
foreach (var file in list)
|
foreach (var fullName in list.Select(file => file.FullName))
|
||||||
{
|
{
|
||||||
if (EntityResolutionHelper.IsAudioFile(file.FullName)) foundAudio++;
|
if (EntityResolutionHelper.IsAudioFile(fullName)) foundAudio++;
|
||||||
if (foundAudio >= 2)
|
if (foundAudio >= 2)
|
||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (EntityResolutionHelper.IsVideoFile(file.FullName)) return false;
|
if (EntityResolutionHelper.IsVideoFile(fullName)) return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
// or a single audio file and no video files
|
// or a single audio file and no video files
|
||||||
|
@ -139,9 +139,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
// Loop through each child file/folder and see if we find a video
|
// Loop through each child file/folder and see if we find a video
|
||||||
foreach (var child in fileSystemEntries)
|
foreach (var child in fileSystemEntries)
|
||||||
{
|
{
|
||||||
|
var filename = child.Name;
|
||||||
|
|
||||||
if ((child.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
if ((child.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
|
||||||
{
|
{
|
||||||
if (IsDvdDirectory(child.Name))
|
if (IsDvdDirectory(filename))
|
||||||
{
|
{
|
||||||
return new T
|
return new T
|
||||||
{
|
{
|
||||||
@ -149,7 +151,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
VideoType = VideoType.Dvd
|
VideoType = VideoType.Dvd
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (IsBluRayDirectory(child.Name))
|
if (IsBluRayDirectory(filename))
|
||||||
{
|
{
|
||||||
return new T
|
return new T
|
||||||
{
|
{
|
||||||
@ -158,7 +160,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (EntityResolutionHelper.IsMultiPartFile(child.Name))
|
if (EntityResolutionHelper.IsMultiPartFile(filename))
|
||||||
{
|
{
|
||||||
multiDiscFolders.Add(child);
|
multiDiscFolders.Add(child);
|
||||||
}
|
}
|
||||||
@ -167,7 +169,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Don't misidentify xbmc trailers as a movie
|
// Don't misidentify xbmc trailers as a movie
|
||||||
if (child.Name.IndexOf(BaseItem.XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase) != -1)
|
if (filename.IndexOf(BaseItem.XbmcTrailerFileSuffix, StringComparison.OrdinalIgnoreCase) != -1)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
@ -215,9 +217,9 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
{
|
{
|
||||||
var videoType = VideoType.BluRay;
|
var videoType = VideoType.BluRay;
|
||||||
|
|
||||||
folders = folders.Where(i =>
|
var folderPaths = folders.Select(i => i.FullName).Where(i =>
|
||||||
{
|
{
|
||||||
var subfolders = Directory.GetDirectories(i.FullName).Select(Path.GetFileName).ToList();
|
var subfolders = Directory.GetDirectories(i).Select(Path.GetFileName).ToList();
|
||||||
|
|
||||||
if (subfolders.Any(IsDvdDirectory))
|
if (subfolders.Any(IsDvdDirectory))
|
||||||
{
|
{
|
||||||
@ -232,16 +234,16 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
}).OrderBy(i => i.FullName).ToList();
|
}).OrderBy(i => i).ToList();
|
||||||
|
|
||||||
if (folders.Count == 0)
|
if (folderPaths.Count == 0)
|
||||||
{
|
{
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
return new T
|
return new T
|
||||||
{
|
{
|
||||||
Path = folders[0].FullName,
|
Path = folderPaths[0],
|
||||||
|
|
||||||
IsMultiPart = true,
|
IsMultiPart = true,
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user