From c87c516ea32b8c9bdd01f76c453b65bf24f9ce86 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 18 Mar 2015 23:47:21 -0400 Subject: [PATCH] updated nuget --- .../Library/LibraryStructureService.cs | 142 ++++++++++-------- .../Sync/IServerSyncProvider.cs | 3 +- .../Library/Resolvers/Movies/MovieResolver.cs | 13 +- .../Sync/MediaSync.cs | 6 +- Nuget/MediaBrowser.Common.Internal.nuspec | 4 +- Nuget/MediaBrowser.Common.nuspec | 2 +- Nuget/MediaBrowser.Model.Signed.nuspec | 2 +- Nuget/MediaBrowser.Server.Core.nuspec | 4 +- 8 files changed, 99 insertions(+), 77 deletions(-) diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index 27944a4ea7..f5fe921cec 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -212,24 +212,26 @@ namespace MediaBrowser.Api.Library File.Create(path); } - - // Need to add a delay here or directory watchers may still pick up the changes - var task = Task.Delay(1000); - // Have to block here to allow exceptions to bubble - Task.WaitAll(task); } finally { - // No need to start if scanning the library because it will handle it - if (!request.RefreshLibrary) + Task.Run(() => { - _libraryMonitor.Start(); - } - } - - if (request.RefreshLibrary) - { - _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + // No need to start if scanning the library because it will handle it + if (request.RefreshLibrary) + { + _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + } + else + { + // Need to add a delay here or directory watchers may still pick up the changes + var task = Task.Delay(1000); + // Have to block here to allow exceptions to bubble + Task.WaitAll(task); + + _libraryMonitor.Start(); + } + }); } } @@ -279,24 +281,26 @@ namespace MediaBrowser.Api.Library } Directory.Move(currentPath, newPath); - - // Need to add a delay here or directory watchers may still pick up the changes - var task = Task.Delay(1000); - // Have to block here to allow exceptions to bubble - Task.WaitAll(task); } finally { - // No need to start if scanning the library because it will handle it - if (!request.RefreshLibrary) + Task.Run(() => { - _libraryMonitor.Start(); - } - } + // No need to start if scanning the library because it will handle it + if (request.RefreshLibrary) + { + _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + } + else + { + // Need to add a delay here or directory watchers may still pick up the changes + var task = Task.Delay(1000); + // Have to block here to allow exceptions to bubble + Task.WaitAll(task); - if (request.RefreshLibrary) - { - _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + _libraryMonitor.Start(); + } + }); } } @@ -325,24 +329,26 @@ namespace MediaBrowser.Api.Library try { _fileSystem.DeleteDirectory(path, true); - - // Need to add a delay here or directory watchers may still pick up the changes - var delayTask = Task.Delay(1000); - // Have to block here to allow exceptions to bubble - Task.WaitAll(delayTask); } finally { - // No need to start if scanning the library because it will handle it - if (!request.RefreshLibrary) + Task.Run(() => { - _libraryMonitor.Start(); - } - } + // No need to start if scanning the library because it will handle it + if (request.RefreshLibrary) + { + _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + } + else + { + // Need to add a delay here or directory watchers may still pick up the changes + var task = Task.Delay(1000); + // Have to block here to allow exceptions to bubble + Task.WaitAll(task); - if (request.RefreshLibrary) - { - _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + _libraryMonitor.Start(); + } + }); } } @@ -362,24 +368,26 @@ namespace MediaBrowser.Api.Library try { LibraryHelpers.AddMediaPath(_fileSystem, request.Name, request.Path, _appPaths); - - // Need to add a delay here or directory watchers may still pick up the changes - var task = Task.Delay(1000); - // Have to block here to allow exceptions to bubble - Task.WaitAll(task); } finally { - // No need to start if scanning the library because it will handle it - if (!request.RefreshLibrary) + Task.Run(() => { - _libraryMonitor.Start(); - } - } + // No need to start if scanning the library because it will handle it + if (request.RefreshLibrary) + { + _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + } + else + { + // Need to add a delay here or directory watchers may still pick up the changes + var task = Task.Delay(1000); + // Have to block here to allow exceptions to bubble + Task.WaitAll(task); - if (request.RefreshLibrary) - { - _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + _libraryMonitor.Start(); + } + }); } } @@ -399,24 +407,26 @@ namespace MediaBrowser.Api.Library try { LibraryHelpers.RemoveMediaPath(_fileSystem, request.Name, request.Path, _appPaths); - - // Need to add a delay here or directory watchers may still pick up the changes - var task = Task.Delay(1000); - // Have to block here to allow exceptions to bubble - Task.WaitAll(task); } finally { - // No need to start if scanning the library because it will handle it - if (!request.RefreshLibrary) + Task.Run(() => { - _libraryMonitor.Start(); - } - } + // No need to start if scanning the library because it will handle it + if (request.RefreshLibrary) + { + _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + } + else + { + // Need to add a delay here or directory watchers may still pick up the changes + var task = Task.Delay(1000); + // Have to block here to allow exceptions to bubble + Task.WaitAll(task); - if (request.RefreshLibrary) - { - _libraryManager.ValidateMediaLibrary(new Progress(), CancellationToken.None); + _libraryMonitor.Start(); + } + }); } } } diff --git a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs index 422349b80e..abf884e9d5 100644 --- a/MediaBrowser.Controller/Sync/IServerSyncProvider.cs +++ b/MediaBrowser.Controller/Sync/IServerSyncProvider.cs @@ -60,7 +60,8 @@ namespace MediaBrowser.Controller.Sync /// /// The path. /// The target. + /// The cancellation token. /// Task<List<DeviceFileInfo>>. - Task> GetFileSystemEntries(string path, SyncTarget target); + Task> GetFileSystemEntries(string path, SyncTarget target, CancellationToken cancellationToken); } } diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs index 95dcee98ad..71daf2b0cf 100644 --- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs +++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs @@ -62,6 +62,11 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies return ResolveVideos