diff options
| author | Luke <luke.pulverenti@gmail.com> | 2016-05-06 01:18:33 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2016-05-06 01:18:33 -0400 |
| commit | ab2476b9e051576fb0ddb90f1879d699c1b4ad93 (patch) | |
| tree | af64cf4319455c2451b62c417742f0f4cb64be5c /MediaBrowser.Api/Library/LibraryStructureService.cs | |
| parent | c27e4154717f61b2cafd57bdbe590c2b1875b136 (diff) | |
| parent | 5a496a1fc8d9ee2e728d6f712ae6bdf4862183f1 (diff) | |
Merge pull request #1710 from MediaBrowser/dev
Dev
Diffstat (limited to 'MediaBrowser.Api/Library/LibraryStructureService.cs')
| -rw-r--r-- | MediaBrowser.Api/Library/LibraryStructureService.cs | 43 |
1 files changed, 2 insertions, 41 deletions
diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs index 817fd9ce0..3cf0d5d93 100644 --- a/MediaBrowser.Api/Library/LibraryStructureService.cs +++ b/MediaBrowser.Api/Library/LibraryStructureService.cs @@ -268,46 +268,7 @@ namespace MediaBrowser.Api.Library /// <param name="request">The request.</param> public void Delete(RemoveVirtualFolder request) { - if (string.IsNullOrWhiteSpace(request.Name)) - { - throw new ArgumentNullException("request"); - } - - var rootFolderPath = _appPaths.DefaultUserViewsPath; - - var path = Path.Combine(rootFolderPath, request.Name); - - if (!_fileSystem.DirectoryExists(path)) - { - throw new DirectoryNotFoundException("The media folder does not exist"); - } - - _libraryMonitor.Stop(); - - try - { - _fileSystem.DeleteDirectory(path, true); - } - finally - { - Task.Run(() => - { - // No need to start if scanning the library because it will handle it - if (request.RefreshLibrary) - { - _libraryManager.ValidateMediaLibrary(new Progress<double>(), 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(); - } - }); - } + _libraryManager.RemoveVirtualFolder(request.Name, request.RefreshLibrary); } /// <summary> @@ -364,7 +325,7 @@ namespace MediaBrowser.Api.Library try { - LibraryHelpers.RemoveMediaPath(_fileSystem, request.Name, request.Path, _appPaths); + _libraryManager.RemoveMediaPath(request.Name, request.Path); } finally { |
