fixes #579 - Year images not getting scanned
This commit is contained in:
parent
39186cc2da
commit
d87a8ce8fa
|
@ -80,6 +80,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
// Don't clutter the log
|
// Don't clutter the log
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
// Don't clutter the log
|
// Don't clutter the log
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -81,6 +81,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
// Don't clutter the log
|
// Don't clutter the log
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -129,6 +129,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
_logger.Info("Pre-scan task cancelled: {0}", task.GetType().Name);
|
_logger.Info("Pre-scan task cancelled: {0}", task.GetType().Name);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -80,6 +80,7 @@ namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
catch (OperationCanceledException)
|
catch (OperationCanceledException)
|
||||||
{
|
{
|
||||||
// Don't clutter the log
|
// Don't clutter the log
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
using MediaBrowser.Controller.Library;
|
||||||
|
using MediaBrowser.Model.Logging;
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Threading;
|
||||||
|
using System.Threading.Tasks;
|
||||||
|
|
||||||
|
namespace MediaBrowser.Server.Implementations.Library.Validators
|
||||||
|
{
|
||||||
|
public class YearsPostScanTask : ILibraryPostScanTask
|
||||||
|
{
|
||||||
|
private readonly ILibraryManager _libraryManager;
|
||||||
|
private readonly ILogger _logger;
|
||||||
|
|
||||||
|
public YearsPostScanTask(ILibraryManager libraryManager, ILogger logger)
|
||||||
|
{
|
||||||
|
_libraryManager = libraryManager;
|
||||||
|
_logger = logger;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Run(IProgress<double> progress, CancellationToken cancellationToken)
|
||||||
|
{
|
||||||
|
var allYears = _libraryManager.RootFolder.RecursiveChildren
|
||||||
|
.Select(i => i.ProductionYear ?? -1)
|
||||||
|
.Where(i => i != -1)
|
||||||
|
.Distinct()
|
||||||
|
.ToList();
|
||||||
|
|
||||||
|
var count = allYears.Count;
|
||||||
|
var numComplete = 0;
|
||||||
|
|
||||||
|
foreach (var yearNumber in allYears)
|
||||||
|
{
|
||||||
|
var year = _libraryManager.GetYear(yearNumber);
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
await year.RefreshMetadata(cancellationToken).ConfigureAwait(false);
|
||||||
|
}
|
||||||
|
catch (OperationCanceledException)
|
||||||
|
{
|
||||||
|
// Don't clutter the log
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
_logger.ErrorException("Error refreshing year {0}", ex, year);
|
||||||
|
}
|
||||||
|
|
||||||
|
numComplete++;
|
||||||
|
double percent = numComplete;
|
||||||
|
percent /= count;
|
||||||
|
percent *= 90;
|
||||||
|
|
||||||
|
progress.Report(percent + 10);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -164,6 +164,7 @@
|
||||||
<Compile Include="Library\Validators\PeopleValidator.cs" />
|
<Compile Include="Library\Validators\PeopleValidator.cs" />
|
||||||
<Compile Include="Library\Validators\StudiosPostScanTask.cs" />
|
<Compile Include="Library\Validators\StudiosPostScanTask.cs" />
|
||||||
<Compile Include="Library\Validators\StudiosValidator.cs" />
|
<Compile Include="Library\Validators\StudiosValidator.cs" />
|
||||||
|
<Compile Include="Library\Validators\YearsPostScanTask.cs" />
|
||||||
<Compile Include="LiveTv\LiveTvManager.cs" />
|
<Compile Include="LiveTv\LiveTvManager.cs" />
|
||||||
<Compile Include="Localization\LocalizationManager.cs" />
|
<Compile Include="Localization\LocalizationManager.cs" />
|
||||||
<Compile Include="MediaEncoder\MediaEncoder.cs" />
|
<Compile Include="MediaEncoder\MediaEncoder.cs" />
|
||||||
|
|
Loading…
Reference in New Issue
Block a user