mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-07-06 05:43:03 +02:00
create notion of locked path
This commit is contained in:
parent
1b4dbe8894
commit
10d4ad98d9
|
@ -32,5 +32,12 @@ namespace MediaBrowser.Controller.Library
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="path">The path.</param>
|
/// <param name="path">The path.</param>
|
||||||
void ReportFileSystemChanged(string path);
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -64,6 +64,13 @@ namespace MediaBrowser.Server.Implementations.FileOrganization
|
||||||
FileSize = new FileInfo(path).Length
|
FileSize = 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 namingOptions = ((LibraryManager)_libraryManager).GetNamingOptions();
|
||||||
var resolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
var resolver = new Naming.TV.EpisodeResolver(namingOptions, new PatternsLogger());
|
||||||
|
|
||||||
|
|
|
@ -78,6 +78,12 @@ namespace MediaBrowser.Server.Implementations.IO
|
||||||
TemporarilyIgnore(path);
|
TemporarilyIgnore(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)
|
public async void ReportFileSystemChangeComplete(string path, bool refreshPath)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(path))
|
if (string.IsNullOrEmpty(path))
|
||||||
|
|
Loading…
Reference in a new issue