mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-18 21:35:51 -04:00
File Browser
New: File Browser to navigate to folders when choosing paths
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extensions;
|
||||
using NzbDrone.Common.Disk;
|
||||
|
||||
namespace NzbDrone.Api.FileSystem
|
||||
{
|
||||
public class FileSystemModule : NzbDroneApiModule
|
||||
{
|
||||
private readonly IFileSystemLookupService _fileSystemLookupService;
|
||||
|
||||
public FileSystemModule(IFileSystemLookupService fileSystemLookupService)
|
||||
: base("/filesystem")
|
||||
{
|
||||
_fileSystemLookupService = fileSystemLookupService;
|
||||
Get["/"] = x => GetContents();
|
||||
}
|
||||
|
||||
private Response GetContents()
|
||||
{
|
||||
var pathQuery = Request.Query.path;
|
||||
var includeFilesQuery = Request.Query.includeFiles;
|
||||
bool includeFiles = false;
|
||||
|
||||
if (includeFilesQuery.HasValue)
|
||||
{
|
||||
includeFiles = Convert.ToBoolean(includeFilesQuery.Value);
|
||||
}
|
||||
|
||||
return _fileSystemLookupService.LookupContents((string)pathQuery.Value, includeFiles).AsResponse();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user