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

@ -224,6 +224,7 @@ namespace MediaBrowser.Model.Configuration
/// </summary>
/// <value><c>true</c> if [enable tv db updates]; otherwise, <c>false</c>.</value>
public bool EnableTvDbUpdates { get; set; }
public bool EnableTmdbUpdates { get; set; }
public bool EnableVideoImageExtraction { get; set; }

View File

@ -1,25 +1,24 @@
<Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" />
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.Model\Web\QueryStringDictionary.cs">
<Files>
<File FileName="MediaBrowser.Server.Implementations\HttpServer\HttpServer.cs" Line="1" Column="1" />
<File FileName="MediaBrowser.Server.Mono\Networking\NetworkManager.cs" Line="1" Column="1" />
<File FileName="MediaBrowser.ServerApplication\ApplicationHost.cs" Line="1" Column="1" />
<File FileName="MediaBrowser.Server.Mono\Native\NativeApp.cs" Line="1" Column="1" />
<File FileName="MediaBrowser.Server.Mono\Program.cs" Line="1" Column="1" />
<File FileName="MediaBrowser.ServerApplication\FFMpeg\FFMpegDownloader.cs" Line="31" Column="30" />
<File FileName="MediaBrowser.Server.Mono\FFMpeg\FFMpegDownloadInfo.cs" Line="1" Column="1" />
<File FileName="MediaBrowser.Model\Web\QueryStringDictionary.cs" Line="26" Column="10" />
</Files>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Release|x86" />
<MonoDevelop.Ide.Workbench>
<Pads>
<Pad Id="ProjectPad">
<State expanded="True">
<Node name="MediaBrowser.Common.Implementations" expanded="True">
<Node name="HttpClientManager" expanded="True" />
</Node>
<Node name="MediaBrowser.Controller" expanded="True">
<Node name="Drawing" expanded="True" />
</Node>
<Node name="MediaBrowser.Model" expanded="True">
<Node name="References" expanded="True" selected="True" />
<Node name="References" expanded="True" />
<Node name="Web" expanded="True" />
</Node>
<Node name="MediaBrowser.Server.Implementations" expanded="True" />
<Node name="MediaBrowser.Server.Mono" expanded="True">
<Node name="FFMpeg" expanded="True" />
<Node name="FFMpeg" expanded="True">
<Node name="FFMpegDownloader.cs" selected="True" />
</Node>
</Node>
</State>
</Pad>
@ -35,6 +34,7 @@
<BreakpointStore>
<Breakpoint file="D:\Development\MediaBrowser\MediaBrowser.Server.Mono\Native\NativeApp.cs" line="23" column="1" />
<Breakpoint file="D:\Development\MediaBrowser\MediaBrowser.Server.Mono\Native\NativeApp.cs" line="15" column="1" />
<Breakpoint file="D:\Development\MediaBrowser\MediaBrowser.Common.Implementations\HttpClientManager\HttpClientManager.cs" line="477" column="17" />
</BreakpointStore>
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />

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));