From 751febc1de65c9f2811deca66d093503968dd514 Mon Sep 17 00:00:00 2001 From: softworkz Date: Fri, 19 Aug 2016 03:00:04 +0200 Subject: 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 --- .../FileOrganization/IFileOrganizationService.cs | 24 +++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Controller/FileOrganization') diff --git a/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs b/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs index daa670d83..9a5b96a24 100644 --- a/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs +++ b/MediaBrowser.Controller/FileOrganization/IFileOrganizationService.cs @@ -1,5 +1,7 @@ -using MediaBrowser.Model.FileOrganization; +using MediaBrowser.Model.Events; +using MediaBrowser.Model.FileOrganization; using MediaBrowser.Model.Querying; +using System; using System.Threading; using System.Threading.Tasks; @@ -7,6 +9,11 @@ namespace MediaBrowser.Controller.FileOrganization { public interface IFileOrganizationService { + event EventHandler> ItemAdded; + event EventHandler> ItemUpdated; + event EventHandler> ItemRemoved; + event EventHandler LogReset; + /// /// Processes the new files. /// @@ -81,5 +88,20 @@ namespace MediaBrowser.Controller.FileOrganization /// Item name. /// The match string to delete. void DeleteSmartMatchEntry(string ItemName, string matchString); + + /// + /// Attempts to add a an item to the list of currently processed items. + /// + /// The result item. + /// Passing true will notify the client to reload all items, otherwise only a single item will be refreshed. + /// True if the item was added, False if the item is already contained in the list. + bool AddToInProgressList(FileOrganizationResult result, bool fullClientRefresh); + + /// + /// Removes an item from the list of currently processed items. + /// + /// The result item. + /// True if the item was removed, False if the item was not contained in the list. + bool RemoveFromInprogressList(FileOrganizationResult result); } } -- cgit v1.2.3