Merge branch 'master' of https://github.com/MediaBrowser/MediaBrowser
This commit is contained in:
commit
716511679f
|
@ -539,7 +539,11 @@ namespace MediaBrowser.Controller.Entities
|
||||||
|
|
||||||
cancellationToken.ThrowIfCancellationRequested();
|
cancellationToken.ThrowIfCancellationRequested();
|
||||||
|
|
||||||
Parallel.ForEach(nonCachedChildren, child =>
|
var options = new ParallelOptions
|
||||||
|
{
|
||||||
|
};
|
||||||
|
|
||||||
|
Parallel.ForEach(nonCachedChildren, options, child =>
|
||||||
{
|
{
|
||||||
BaseItem currentChild;
|
BaseItem currentChild;
|
||||||
|
|
||||||
|
|
|
@ -139,7 +139,7 @@ namespace MediaBrowser.Controller.Providers.MediaInfo
|
||||||
// If we don't have a ProductionYear try and get it from PremiereDate
|
// If we don't have a ProductionYear try and get it from PremiereDate
|
||||||
if (audio.PremiereDate.HasValue && !audio.ProductionYear.HasValue)
|
if (audio.PremiereDate.HasValue && !audio.ProductionYear.HasValue)
|
||||||
{
|
{
|
||||||
audio.ProductionYear = audio.PremiereDate.Value.Year;
|
audio.ProductionYear = audio.PremiereDate.Value.ToLocalTime().Year;
|
||||||
}
|
}
|
||||||
|
|
||||||
FetchGenres(audio, tags);
|
FetchGenres(audio, tags);
|
||||||
|
|
|
@ -927,19 +927,19 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
movie.OfficialRating = ourRelease.certification ?? usRelease.certification;
|
movie.OfficialRating = ourRelease.certification ?? usRelease.certification;
|
||||||
if (ourRelease.release_date > new DateTime(1900, 1, 1))
|
if (ourRelease.release_date > new DateTime(1900, 1, 1))
|
||||||
{
|
{
|
||||||
movie.PremiereDate = ourRelease.release_date;
|
movie.PremiereDate = ourRelease.release_date.ToUniversalTime();
|
||||||
movie.ProductionYear = ourRelease.release_date.Year;
|
movie.ProductionYear = ourRelease.release_date.Year;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
movie.PremiereDate = usRelease.release_date;
|
movie.PremiereDate = usRelease.release_date.ToUniversalTime();
|
||||||
movie.ProductionYear = usRelease.release_date.Year;
|
movie.ProductionYear = usRelease.release_date.Year;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
//no specific country release info at all
|
//no specific country release info at all
|
||||||
movie.PremiereDate = movieData.release_date;
|
movie.PremiereDate = movieData.release_date.ToUniversalTime();
|
||||||
movie.ProductionYear = movieData.release_date.Year;
|
movie.ProductionYear = movieData.release_date.Year;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -231,12 +231,12 @@ namespace MediaBrowser.Controller.Providers.Movies
|
||||||
|
|
||||||
if (DateTime.TryParseExact(searchResult.Birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
if (DateTime.TryParseExact(searchResult.Birthday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
||||||
{
|
{
|
||||||
person.PremiereDate = date;
|
person.PremiereDate = date.ToUniversalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DateTime.TryParseExact(searchResult.Deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
if (DateTime.TryParseExact(searchResult.Deathday, "yyyy-MM-dd", new CultureInfo("en-US"), DateTimeStyles.None, out date))
|
||||||
{
|
{
|
||||||
person.EndDate = date;
|
person.EndDate = date.ToUniversalTime();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!string.IsNullOrEmpty(searchResult.Homepage))
|
if (!string.IsNullOrEmpty(searchResult.Homepage))
|
||||||
|
|
|
@ -516,10 +516,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
||||||
|
/// <param name="forceCreation">if set to <c>true</c> [force creation].</param>
|
||||||
/// <returns>Task{Person}.</returns>
|
/// <returns>Task{Person}.</returns>
|
||||||
private Task<Person> GetPerson(string name, CancellationToken cancellationToken, bool allowSlowProviders = false)
|
private Task<Person> GetPerson(string name, CancellationToken cancellationToken, bool allowSlowProviders = false, bool forceCreation = false)
|
||||||
{
|
{
|
||||||
return GetImagesByNameItem<Person>(ConfigurationManager.ApplicationPaths.PeoplePath, name, cancellationToken, allowSlowProviders);
|
return GetImagesByNameItem<Person>(ConfigurationManager.ApplicationPaths.PeoplePath, name, cancellationToken, allowSlowProviders, forceCreation);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -569,7 +570,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// The images by name item cache
|
/// The images by name item cache
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private readonly ConcurrentDictionary<string, object> ImagesByNameItemCache = new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
private readonly ConcurrentDictionary<string, object> _imagesByNameItemCache = new ConcurrentDictionary<string, object>(StringComparer.OrdinalIgnoreCase);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Generically retrieves an IBN item
|
/// Generically retrieves an IBN item
|
||||||
|
@ -579,9 +580,11 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
/// <param name="name">The name.</param>
|
/// <param name="name">The name.</param>
|
||||||
/// <param name="cancellationToken">The cancellation token.</param>
|
/// <param name="cancellationToken">The cancellation token.</param>
|
||||||
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
/// <param name="allowSlowProviders">if set to <c>true</c> [allow slow providers].</param>
|
||||||
|
/// <param name="forceCreation">if set to <c>true</c> [force creation].</param>
|
||||||
/// <returns>Task{``0}.</returns>
|
/// <returns>Task{``0}.</returns>
|
||||||
/// <exception cref="System.ArgumentNullException"></exception>
|
/// <exception cref="System.ArgumentNullException">
|
||||||
private Task<T> GetImagesByNameItem<T>(string path, string name, CancellationToken cancellationToken, bool allowSlowProviders = true)
|
/// </exception>
|
||||||
|
private Task<T> GetImagesByNameItem<T>(string path, string name, CancellationToken cancellationToken, bool allowSlowProviders = true, bool forceCreation = false)
|
||||||
where T : BaseItem, new()
|
where T : BaseItem, new()
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
|
@ -596,7 +599,16 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
var key = Path.Combine(path, FileSystem.GetValidFilename(name));
|
var key = Path.Combine(path, FileSystem.GetValidFilename(name));
|
||||||
|
|
||||||
var obj = ImagesByNameItemCache.GetOrAdd(key, keyname => CreateImagesByNameItem<T>(path, name, cancellationToken, allowSlowProviders));
|
if (forceCreation)
|
||||||
|
{
|
||||||
|
var task = CreateImagesByNameItem<T>(path, name, cancellationToken, allowSlowProviders);
|
||||||
|
|
||||||
|
_imagesByNameItemCache.AddOrUpdate(key, task, (keyName, oldValue) => task);
|
||||||
|
|
||||||
|
return task;
|
||||||
|
}
|
||||||
|
|
||||||
|
var obj = _imagesByNameItemCache.GetOrAdd(key, keyname => CreateImagesByNameItem<T>(path, name, cancellationToken, allowSlowProviders));
|
||||||
|
|
||||||
return obj as Task<T>;
|
return obj as Task<T>;
|
||||||
}
|
}
|
||||||
|
@ -676,9 +688,6 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
/// <returns>Task.</returns>
|
/// <returns>Task.</returns>
|
||||||
public async Task ValidatePeople(CancellationToken cancellationToken, IProgress<double> progress)
|
public async Task ValidatePeople(CancellationToken cancellationToken, IProgress<double> progress)
|
||||||
{
|
{
|
||||||
// Clear the IBN cache
|
|
||||||
ImagesByNameItemCache.Clear();
|
|
||||||
|
|
||||||
const int maxTasks = 250;
|
const int maxTasks = 250;
|
||||||
|
|
||||||
var tasks = new List<Task>();
|
var tasks = new List<Task>();
|
||||||
|
@ -713,7 +722,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await GetPerson(currentPerson.Name, cancellationToken, allowSlowProviders: true).ConfigureAwait(false);
|
await GetPerson(currentPerson.Name, cancellationToken, true, true).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
catch (IOException ex)
|
catch (IOException ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -206,7 +206,7 @@ namespace MediaBrowser.ServerApplication.Controls
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
txtPremeireDate.Visibility = Visibility.Visible;
|
txtPremeireDate.Visibility = Visibility.Visible;
|
||||||
txtPremeireDate.Text = "Premiered " + item.PremiereDate.Value.ToShortDateString();
|
txtPremeireDate.Text = "Premiered " + item.PremiereDate.Value.ToLocalTime().ToShortDateString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user