adding settings around automatic tmdb updates

pull/702/head
Luke Pulverenti 11 years ago
parent 3d3876c9a9
commit 559acbc074

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

@ -1,25 +1,24 @@
<Properties> <Properties>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug|x86" /> <MonoDevelop.Ide.Workspace ActiveConfiguration="Release|x86" />
<MonoDevelop.Ide.Workbench ActiveDocument="MediaBrowser.Model\Web\QueryStringDictionary.cs"> <MonoDevelop.Ide.Workbench>
<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>
<Pads> <Pads>
<Pad Id="ProjectPad"> <Pad Id="ProjectPad">
<State expanded="True"> <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="MediaBrowser.Model" expanded="True">
<Node name="References" expanded="True" selected="True" /> <Node name="References" expanded="True" />
<Node name="Web" expanded="True" /> <Node name="Web" expanded="True" />
</Node> </Node>
<Node name="MediaBrowser.Server.Implementations" expanded="True" />
<Node name="MediaBrowser.Server.Mono" 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> </Node>
</State> </State>
</Pad> </Pad>
@ -35,6 +34,7 @@
<BreakpointStore> <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="23" column="1" />
<Breakpoint file="D:\Development\MediaBrowser\MediaBrowser.Server.Mono\Native\NativeApp.cs" line="15" 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> </BreakpointStore>
</MonoDevelop.Ide.DebuggingService.Breakpoints> </MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches /> <MonoDevelop.Ide.DebuggingService.PinnedWatches />

@ -60,7 +60,7 @@ namespace MediaBrowser.Providers.Movies
/// <returns>Task.</returns> /// <returns>Task.</returns>
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken) public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
{ {
if (!_config.Configuration.EnableInternetProviders) if (!_config.Configuration.EnableInternetProviders || !_config.Configuration.EnableTmdbUpdates)
{ {
progress.Report(100); progress.Report(100);
return; return;
@ -101,8 +101,8 @@ namespace MediaBrowser.Providers.Movies
var updatedIds = await GetIdsToUpdate(lastUpdateDate, 1, cancellationToken).ConfigureAwait(false); 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)); var idsToUpdate = updatedIds.Where(i => !string.IsNullOrWhiteSpace(i) && existingDictionary.ContainsKey(i));
await UpdatePeople(idsToUpdate, path, progress, cancellationToken).ConfigureAwait(false); await UpdatePeople(idsToUpdate, path, progress, cancellationToken).ConfigureAwait(false);
@ -174,14 +174,9 @@ namespace MediaBrowser.Providers.Movies
{ {
await UpdatePerson(id, peopleDataPath, cancellationToken).ConfigureAwait(false); 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 _logger.ErrorException("Error updating tmdb person id {0}", ex, id);
// We have to fail this to make it run again otherwise new episode data could potentially be missing
if (ex.IsTimedOut)
{
throw;
}
} }
numComplete++; numComplete++;

@ -155,7 +155,7 @@ namespace MediaBrowser.Providers.Movies
if (!string.IsNullOrEmpty(id)) if (!string.IsNullOrEmpty(id))
{ {
await FetchInfo(person, id, cancellationToken).ConfigureAwait(false); await FetchInfo(person, id, force, cancellationToken).ConfigureAwait(false);
} }
else else
{ {
@ -219,9 +219,10 @@ namespace MediaBrowser.Providers.Movies
/// </summary> /// </summary>
/// <param name="person">The person.</param> /// <param name="person">The person.</param>
/// <param name="id">The id.</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> /// <param name="cancellationToken">The cancellation token.</param>
/// <returns>Task.</returns> /// <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); var personDataPath = GetPersonDataPath(ConfigurationManager.ApplicationPaths, id);
@ -240,7 +241,7 @@ namespace MediaBrowser.Providers.Movies
await DownloadPersonInfo(id, personDataPath, cancellationToken).ConfigureAwait(false); 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)); var info = JsonSerializer.DeserializeFromFile<PersonResult>(Path.Combine(personDataPath, dataFileName));

Loading…
Cancel
Save