mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-14 02:37:08 -07:00
code to support import existing series.
This commit is contained in:
parent
fa224cc59c
commit
13aa79d5f9
15 changed files with 175 additions and 109 deletions
40
NzbDrone.Api/RootFolders/RootFolderModule.cs
Normal file
40
NzbDrone.Api/RootFolders/RootFolderModule.cs
Normal file
|
@ -0,0 +1,40 @@
|
|||
using System.Linq;
|
||||
using Nancy;
|
||||
using NzbDrone.Api.Extentions;
|
||||
using NzbDrone.Core.Providers;
|
||||
using NzbDrone.Core.Repository;
|
||||
|
||||
namespace NzbDrone.Api.RootFolders
|
||||
{
|
||||
public class RootDirModule : NzbDroneApiModule
|
||||
{
|
||||
private readonly RootDirProvider _rootDirProvider;
|
||||
|
||||
public RootDirModule(RootDirProvider rootDirProvider)
|
||||
: base("//rootdir")
|
||||
{
|
||||
_rootDirProvider = rootDirProvider;
|
||||
|
||||
Get["/"] = x => GetRootFolders();
|
||||
Post["/"] = x => AddRootFolder();
|
||||
Delete["/{id}"] = x => DeleteRootFolder((int)x.id);
|
||||
}
|
||||
|
||||
private Response AddRootFolder()
|
||||
{
|
||||
var dir = _rootDirProvider.Add(Request.Body.FromJson<RootDir>());
|
||||
return dir.AsResponse(HttpStatusCode.Created);
|
||||
}
|
||||
|
||||
private Response GetRootFolders()
|
||||
{
|
||||
return _rootDirProvider.AllWithFreeSpace().AsResponse();
|
||||
}
|
||||
|
||||
private Response DeleteRootFolder(int folderId)
|
||||
{
|
||||
_rootDirProvider.Remove(folderId);
|
||||
return new Response { StatusCode = HttpStatusCode.OK };
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue