mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-07 11:57:55 +02:00
update auto-organize error handling
This commit is contained in:
parent
f641c501a7
commit
497e93aae8
1 changed files with 21 additions and 1 deletions
|
@ -53,9 +53,29 @@ namespace Emby.Server.Implementations.FileOrganization
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private bool IsValidWatchLocation(string path, List<string> libraryFolderPaths)
|
||||||
|
{
|
||||||
|
if (IsPathAlreadyInMediaLibrary(path, libraryFolderPaths))
|
||||||
|
{
|
||||||
|
_logger.Info("Folder {0} is not eligible for auto-organize because it is also part of an Emby library", path);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private bool IsPathAlreadyInMediaLibrary(string path, List<string> libraryFolderPaths)
|
||||||
|
{
|
||||||
|
return libraryFolderPaths.Any(i => string.Equals(i, path, StringComparison.Ordinal) || _fileSystem.ContainsSubPath(i, path));
|
||||||
|
}
|
||||||
|
|
||||||
public async Task Organize(AutoOrganizeOptions options, CancellationToken cancellationToken, IProgress<double> progress)
|
public async Task Organize(AutoOrganizeOptions options, CancellationToken cancellationToken, IProgress<double> progress)
|
||||||
{
|
{
|
||||||
var watchLocations = options.TvOptions.WatchLocations.ToList();
|
var libraryFolderPaths = _libraryManager.GetVirtualFolders().SelectMany(i => i.Locations).ToList();
|
||||||
|
|
||||||
|
var watchLocations = options.TvOptions.WatchLocations
|
||||||
|
.Where(i => IsValidWatchLocation(i, libraryFolderPaths))
|
||||||
|
.ToList();
|
||||||
|
|
||||||
var eligibleFiles = watchLocations.SelectMany(GetFilesToOrganize)
|
var eligibleFiles = watchLocations.SelectMany(GetFilesToOrganize)
|
||||||
.OrderBy(_fileSystem.GetCreationTimeUtc)
|
.OrderBy(_fileSystem.GetCreationTimeUtc)
|
||||||
|
|
Loading…
Reference in a new issue