mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-07-16 19:23:38 +01:00
improve cancellation support of auto-organize
This commit is contained in:
@@ -72,17 +72,24 @@ namespace Emby.Server.Implementations.FileOrganization
|
||||
|
||||
foreach (var file in eligibleFiles)
|
||||
{
|
||||
cancellationToken.ThrowIfCancellationRequested();
|
||||
|
||||
var organizer = new EpisodeFileOrganizer(_organizationService, _config, _fileSystem, _logger, _libraryManager,
|
||||
_libraryMonitor, _providerManager);
|
||||
|
||||
try
|
||||
{
|
||||
var result = await organizer.OrganizeEpisodeFile(file.FullName, options, options.TvOptions.OverwriteExistingEpisodes, cancellationToken).ConfigureAwait(false);
|
||||
|
||||
if (result.Status == FileSortingStatus.Success && !processedFolders.Contains(file.DirectoryName, StringComparer.OrdinalIgnoreCase))
|
||||
{
|
||||
processedFolders.Add(file.DirectoryName);
|
||||
}
|
||||
}
|
||||
catch (OperationCanceledException)
|
||||
{
|
||||
break;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_logger.ErrorException("Error organizing episode {0}", ex, file.FullName);
|
||||
|
||||
Reference in New Issue
Block a user