diff options
| author | softworkz <softworkz@hotmail.com> | 2016-08-19 03:00:04 +0200 |
|---|---|---|
| committer | softworkz <softworkz@hotmail.com> | 2016-08-20 01:03:30 +0200 |
| commit | 751febc1de65c9f2811deca66d093503968dd514 (patch) | |
| tree | 37474c3c4822f2a112b13b2c5cd46dd5164d94f6 /MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs | |
| parent | d1da8f4449580dd642ae71580e9c40cab8aedbe3 (diff) | |
Auto-Organize: Async operation and instant feedback UI (reworked)
This commit includes changes to enable and stabilize asyncronous
operation in the auto-organize area. Here are the key points:
- The auto-organize correction dialog is now closed (almost) instantly.
This means that the user does not have to wait until the file copy/move
operation is completed in order to continue. (even with local HDs the
copy/move process can take several minutes or even much longer with
network destination).
- This commit also implements locking of files to be organized in order
to prevent parallel processing of the same item. In effect, there can be
2 or more manual organization operations active even while the normal
auto-organization task is running without causing any problems
- The items that are currently being processed are indicated as such in
the log with an orange color and a spinner graphic
- The client display is refreshed through websocket messages
- A side effect of this is that other clients showing the auto-organize
log at the same time are always up-to-date as well
Diffstat (limited to 'MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs | 16 |
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) { |
