updated tvdb search

This commit is contained in:
Luke Pulverenti
2015-01-27 01:50:40 -05:00
parent f5919990c9
commit b3127f19b5
15 changed files with 175 additions and 55 deletions

View File

@@ -894,12 +894,14 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
public string GetUserDataKey()
{
if (!string.IsNullOrWhiteSpace(_userDataKey))
if (string.IsNullOrWhiteSpace(_userDataKey))
{
return _userDataKey;
var key = CreateUserDataKey();
_userDataKey = key;
return key;
}
return _userDataKey ?? (_userDataKey = CreateUserDataKey());
return _userDataKey;
}
protected virtual string CreateUserDataKey()
@@ -914,6 +916,12 @@ namespace MediaBrowser.Controller.Entities
return current.IsInMixedFolder == newItem.IsInMixedFolder;
}
public void AfterMetadataRefresh()
{
_sortName = null;
_userDataKey = null;
}
/// <summary>
/// Gets the preferred metadata language.
/// </summary>

View File

@@ -121,12 +121,6 @@ namespace MediaBrowser.Controller.Entities
return args;
}
// Cache this since it will be used a lot
/// <summary>
/// The null task result
/// </summary>
private static readonly Task NullTaskResult = Task.FromResult<object>(null);
/// <summary>
/// Compare our current children (presumably just read from the repo) with the current state of the file system and adjust for any changes
/// ***Currently does not contain logic to maintain items that are unavailable in the file system***
@@ -138,7 +132,7 @@ namespace MediaBrowser.Controller.Entities
/// <param name="refreshOptions">The refresh options.</param>
/// <param name="directoryService">The directory service.</param>
/// <returns>Task.</returns>
protected override async Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
protected override Task ValidateChildrenInternal(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
var list = PhysicalLocationsList.ToList();
@@ -146,8 +140,10 @@ namespace MediaBrowser.Controller.Entities
if (!list.SequenceEqual(PhysicalLocationsList))
{
await UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken).ConfigureAwait(false);
return UpdateToRepository(ItemUpdateType.MetadataImport, cancellationToken);
}
return Task.FromResult(true);
}
/// <summary>

View File

@@ -373,12 +373,7 @@ namespace MediaBrowser.Controller.Entities
/// <returns>Task.</returns>
public Task ValidateChildren(IProgress<double> progress, CancellationToken cancellationToken, MetadataRefreshOptions metadataRefreshOptions, bool recursive = true)
{
return ValidateChildrenWithCancellationSupport(progress, cancellationToken, recursive, true, metadataRefreshOptions, metadataRefreshOptions.DirectoryService);
}
private Task ValidateChildrenWithCancellationSupport(IProgress<double> progress, CancellationToken cancellationToken, bool recursive, bool refreshChildMetadata, MetadataRefreshOptions refreshOptions, IDirectoryService directoryService)
{
return ValidateChildrenInternal(progress, cancellationToken, recursive, refreshChildMetadata, refreshOptions, directoryService);
return ValidateChildrenInternal(progress, cancellationToken, recursive, true, metadataRefreshOptions, metadataRefreshOptions.DirectoryService);
}
private Dictionary<Guid, BaseItem> GetActualChildrenDictionary()
@@ -676,7 +671,7 @@ namespace MediaBrowser.Controller.Entities
}
});
await child.ValidateChildrenWithCancellationSupport(innerProgress, cancellationToken, true, false, null, directoryService)
await child.ValidateChildrenInternal(innerProgress, cancellationToken, true, false, null, directoryService)
.ConfigureAwait(false);
}
}

View File

@@ -54,5 +54,10 @@ namespace MediaBrowser.Controller.Entities
/// Gets the item identities.
/// </summary>
List<IItemIdentity> Identities { get; set; }
/// <summary>
/// Afters the metadata refresh.
/// </summary>
void AfterMetadataRefresh();
}
}

View File

@@ -138,6 +138,7 @@ namespace MediaBrowser.Controller.Entities.Movies
public async Task RefreshAllMetadata(MetadataRefreshOptions refreshOptions, IProgress<double> progress, CancellationToken cancellationToken)
{
var b = this;
// Refresh bottom up, children first, then the boxset
// By then hopefully the movies within will have Tmdb collection values
var items = GetRecursiveChildren().ToList();

View File

@@ -1,12 +1,12 @@
using MediaBrowser.Controller.Providers;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Entities;
using MediaBrowser.Model.Users;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;
using MediaBrowser.Model.Users;
namespace MediaBrowser.Controller.Entities
{

View File

@@ -229,16 +229,16 @@ namespace MediaBrowser.Controller.Entities
/// <returns>System.String.</returns>
private string GetConfigurationDirectoryPath(string username)
{
if (string.IsNullOrEmpty(username))
{
throw new ArgumentNullException("username");
}
var parentPath = ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath;
// Legacy
if (!UsesIdForConfigurationPath)
{
if (string.IsNullOrEmpty(username))
{
throw new ArgumentNullException("username");
}
var safeFolderName = FileSystem.GetValidFilename(username);
return System.IO.Path.Combine(ConfigurationManager.ApplicationPaths.UserConfigurationDirectoryPath, safeFolderName);