The Free Software Media System - Server Backend & API
create notion of locked path
Luke Pulverenti10d4ad98d9fe
diff --git a/MediaBrowser.Controller/Library/ILibraryMonitor.cs b/MediaBrowser.Controller/Library/ILibraryMonitor.csindex 918382f049..e965e47d60 100644--- a/MediaBrowser.Controller/Library/ILibraryMonitor.cs+++ b/MediaBrowser.Controller/Library/ILibraryMonitor.cs@@ -32,5 +32,12 @@ namespace MediaBrowser.Controller.Library/// </summary>/// <param name="path">The path.</param>void ReportFileSystemChanged(string path);++ /// <summary>+ /// Determines whether [is path locked] [the specified path].+ /// </summary>+ /// <param name="path">The path.</param>+ /// <returns><c>true</c> if [is path locked] [the specified path]; otherwise, <c>false</c>.</returns>+ bool IsPathLocked(string path);}}\ No newline at end of filediff --git a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.csindex 2d3c203a23..42f88a5c0d 100644--- a/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs+++ b/MediaBrowser.Server.Implementations/FileOrganization/EpisodeFileOrganizer.cs@@ -64,6 +64,13 @@ namespace MediaBrowser.Server.Implementations.FileOrganizationFileSize = new FileInfo(path).Length};+ if (_libraryMonitor.IsPathLocked(path))+ {+ result.Status = FileSortingStatus.Failure;+ result.StatusMessage = "Path is locked by other processes. Please try again later.";+ return result;+ }+var namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();var resolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());diff --git a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.csindex 764eb7c683..25fda3ac10 100644--- a/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs+++ b/MediaBrowser.Server.Implementations/IO/LibraryMonitor.cs@@ -78,6 +78,12 @@ namespace MediaBrowser.Server.Implementations.IOTemporarilyIgnore(path);}+ public bool IsPathLocked(string path)+ {+ var lockedPaths = _tempIgnoredPaths.Keys.ToList();+ return lockedPaths.Any(i => string.Equals(i, path, StringComparison.OrdinalIgnoreCase) || _fileSystem.ContainsSubPath(i, path));+ }+public async void ReportFileSystemChangeComplete(string path, bool refreshPath){if (string.IsNullOrEmpty(path))