adding settings around automatic tmdb updates

This commit is contained in:
Luke Pulverenti
2013-10-13 19:56:56 -04:00
parent 3d3876c9a9
commit 559acbc074
4 changed files with 24 additions and 27 deletions

View File

@@ -60,7 +60,7 @@ namespace MediaBrowser.Providers.Movies
/// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{
if (!_config.Configuration.EnableInternetProviders)
if (!_config.Configuration.EnableInternetProviders || !_config.Configuration.EnableTmdbUpdates)
{
progress.Report(100);
return;
@@ -101,8 +101,8 @@ namespace MediaBrowser.Providers.Movies
var updatedIds = await GetIdsToUpdate(lastUpdateDate, 1, cancellationToken).ConfigureAwait(false);
var existingDictionary = existingDirectories.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
var existingDictionary = existingDirectories.ToDictionary(i => i, StringComparer.OrdinalIgnoreCase);
var idsToUpdate = updatedIds.Where(i => !string.IsNullOrWhiteSpace(i) && existingDictionary.ContainsKey(i));
await UpdatePeople(idsToUpdate, path, progress, cancellationToken).ConfigureAwait(false);
@@ -174,14 +174,9 @@ namespace MediaBrowser.Providers.Movies
{
await UpdatePerson(id, peopleDataPath, cancellationToken).ConfigureAwait(false);
}
catch (HttpException ex)
catch (Exception ex)
{
// Already logged at lower levels, but don't fail the whole operation, unless timed out
// We have to fail this to make it run again otherwise new episode data could potentially be missing
if (ex.IsTimedOut)
{
throw;
}
_logger.ErrorException("Error updating tmdb person id {0}", ex, id);
}
numComplete++;

View File

@@ -155,7 +155,7 @@ namespace MediaBrowser.Providers.Movies
if (!string.IsNullOrEmpty(id))
{
await FetchInfo(person, id, cancellationToken).ConfigureAwait(false);
await FetchInfo(person, id, force, cancellationToken).ConfigureAwait(false);
}
else
{
@@ -219,9 +219,10 @@ namespace MediaBrowser.Providers.Movies
/// </summary>
/// <param name="person">The person.</param>
/// <param name="id">The id.</param>
/// <param name="isForcedRefresh">if set to <c>true</c> [is forced refresh].</param>
/// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns>
private async Task FetchInfo(Person person, string id, CancellationToken cancellationToken)
private async Task FetchInfo(Person person, string id, bool isForcedRefresh, CancellationToken cancellationToken)
{
var personDataPath = GetPersonDataPath(ConfigurationManager.ApplicationPaths, id);
@@ -240,7 +241,7 @@ namespace MediaBrowser.Providers.Movies
await DownloadPersonInfo(id, personDataPath, cancellationToken).ConfigureAwait(false);
}
//if (!HasAltMeta(person))
if (isForcedRefresh || ConfigurationManager.Configuration.EnableTmdbUpdates || !HasAltMeta(person))
{
var info = JsonSerializer.DeserializeFromFile<PersonResult>(Path.Combine(personDataPath, dataFileName));