mirror of
https://github.com/Prowlarr/Prowlarr.git
synced 2026-04-17 21:44:48 -04:00
New: Ensure all unmapped folders are fetched when importing from a root folder
Co-Authored-By: Mark McDowall <markus101@users.noreply.github.com> #4548
This commit is contained in:
@@ -66,7 +66,7 @@ namespace NzbDrone.Api.Movies
|
||||
|
||||
Profile tempProfile = _profileService.All().First();
|
||||
|
||||
RootFolder rootFolder = _rootFolderService.Get(Request.Query.Id);
|
||||
RootFolder rootFolder = _rootFolderService.Get(Request.Query.Id, true);
|
||||
|
||||
int page = Request.Query.page;
|
||||
int per_page = Request.Query.per_page;
|
||||
|
||||
@@ -41,7 +41,7 @@ namespace NzbDrone.Api.RootFolders
|
||||
|
||||
private RootFolderResource GetRootFolder(int id)
|
||||
{
|
||||
return _rootFolderService.Get(id).ToResource();
|
||||
return _rootFolderService.Get(id, true).ToResource();
|
||||
}
|
||||
|
||||
private int CreateRootFolder(RootFolderResource rootFolderResource)
|
||||
|
||||
@@ -142,7 +142,7 @@ namespace NzbDrone.Core.Test.RootFolderTests
|
||||
.Setup(s => s.GetDirectories(rootFolder.Path))
|
||||
.Returns(folders);
|
||||
|
||||
var unmappedFolders = Subject.Get(rootFolder.Id).UnmappedFolders;
|
||||
var unmappedFolders = Subject.Get(rootFolder.Id, true).UnmappedFolders;
|
||||
|
||||
unmappedFolders.Count.Should().BeGreaterThan(0);
|
||||
unmappedFolders.Should().NotContain(u => u.Name == subFolder);
|
||||
|
||||
@@ -18,7 +18,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
List<RootFolder> AllWithUnmappedFolders();
|
||||
RootFolder Add(RootFolder rootDir);
|
||||
void Remove(int id);
|
||||
RootFolder Get(int id);
|
||||
RootFolder Get(int id, bool timeout);
|
||||
string GetBestRootFolderPath(string path);
|
||||
}
|
||||
|
||||
@@ -73,7 +73,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
{
|
||||
if (folder.Path.IsPathValid())
|
||||
{
|
||||
GetDetails(folder);
|
||||
GetDetails(folder, true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -114,7 +114,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
|
||||
_rootFolderRepository.Insert(rootFolder);
|
||||
|
||||
GetDetails(rootFolder);
|
||||
GetDetails(rootFolder, true);
|
||||
|
||||
return rootFolder;
|
||||
}
|
||||
@@ -161,10 +161,10 @@ namespace NzbDrone.Core.RootFolders
|
||||
return results.OrderBy(u => u.Name, StringComparer.InvariantCultureIgnoreCase).ToList();
|
||||
}
|
||||
|
||||
public RootFolder Get(int id)
|
||||
public RootFolder Get(int id, bool timeout)
|
||||
{
|
||||
var rootFolder = _rootFolderRepository.Get(id);
|
||||
GetDetails(rootFolder);
|
||||
GetDetails(rootFolder, timeout);
|
||||
|
||||
return rootFolder;
|
||||
}
|
||||
@@ -183,7 +183,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
return possibleRootFolder.Path;
|
||||
}
|
||||
|
||||
private void GetDetails(RootFolder rootFolder)
|
||||
private void GetDetails(RootFolder rootFolder, bool timeout)
|
||||
{
|
||||
Task.Run(() =>
|
||||
{
|
||||
@@ -194,7 +194,7 @@ namespace NzbDrone.Core.RootFolders
|
||||
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
|
||||
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
||||
}
|
||||
}).Wait(5000);
|
||||
}).Wait(timeout ? 5000 : -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ using NzbDrone.Core.RootFolders;
|
||||
using NzbDrone.Core.Validation.Paths;
|
||||
using NzbDrone.SignalR;
|
||||
using Radarr.Http;
|
||||
using Radarr.Http.Extensions;
|
||||
|
||||
namespace Radarr.Api.V3.RootFolders
|
||||
{
|
||||
@@ -41,7 +42,9 @@ namespace Radarr.Api.V3.RootFolders
|
||||
|
||||
private RootFolderResource GetRootFolder(int id)
|
||||
{
|
||||
return _rootFolderService.Get(id).ToResource();
|
||||
var timeout = Request.GetBooleanQueryParameter("timeout", true);
|
||||
|
||||
return _rootFolderService.Get(id, timeout).ToResource();
|
||||
}
|
||||
|
||||
private int CreateRootFolder(RootFolderResource rootFolderResource)
|
||||
|
||||
Reference in New Issue
Block a user