aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs')
-rw-r--r--MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs16
1 files changed, 16 insertions, 0 deletions
diff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
index 39992b65d..5e01666a9 100644
--- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
+++ b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs
@@ -272,6 +272,18 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
var originalExtractedSeriesString = result.ExtractedName;
+ bool isNew = string.IsNullOrWhiteSpace(result.Id);
+
+ if (isNew)
+ {
+ await _organizationService.SaveResult(result, cancellationToken);
+ }
+
+ if (!_organizationService.AddToInProgressList(result, isNew))
+ {
+ throw new Exception("File is currently processed otherwise. Please try again later.");
+ }
+
try
{
// Proceed to sort the file
@@ -363,6 +375,10 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
_logger.Warn(ex.Message);
return;
}
+ finally
+ {
+ _organizationService.RemoveFromInprogressList(result);
+ }
if (rememberCorrection)
{