mirror of https://github.com/lidarr/Lidarr
New: Include total space with root folders
This commit is contained in:
parent
28a508bed7
commit
fe56c62a2b
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using NzbDrone.Core.RootFolders;
|
||||
using Lidarr.Http.REST;
|
||||
|
@ -9,6 +9,7 @@ namespace Lidarr.Api.V1.RootFolders
|
|||
{
|
||||
public string Path { get; set; }
|
||||
public long? FreeSpace { get; set; }
|
||||
public long? TotalSpace { get; set; }
|
||||
|
||||
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
||||
}
|
||||
|
@ -25,6 +26,7 @@ namespace Lidarr.Api.V1.RootFolders
|
|||
|
||||
Path = model.Path,
|
||||
FreeSpace = model.FreeSpace,
|
||||
TotalSpace = model.TotalSpace,
|
||||
UnmappedFolders = model.UnmappedFolders
|
||||
};
|
||||
}
|
||||
|
|
|
@ -50,7 +50,11 @@ namespace NzbDrone.Core.Datastore
|
|||
RegisterMappers();
|
||||
|
||||
Mapper.Entity<Config>().RegisterModel("Config");
|
||||
Mapper.Entity<RootFolder>().RegisterModel("RootFolders").Ignore(r => r.FreeSpace);
|
||||
|
||||
Mapper.Entity<RootFolder>().RegisterModel("RootFolders")
|
||||
.Ignore(r => r.FreeSpace)
|
||||
.Ignore(r => r.TotalSpace);
|
||||
|
||||
Mapper.Entity<ScheduledTask>().RegisterModel("ScheduledTasks");
|
||||
|
||||
Mapper.Entity<IndexerDefinition>().RegisterDefinition("Indexers")
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using NzbDrone.Core.Datastore;
|
||||
|
||||
|
||||
|
@ -9,6 +9,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
public string Path { get; set; }
|
||||
|
||||
public long? FreeSpace { get; set; }
|
||||
public long? TotalSpace { get; set; }
|
||||
|
||||
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
||||
}
|
||||
|
|
|
@ -73,6 +73,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
if (folder.Path.IsPathValid() && _diskProvider.FolderExists(folder.Path))
|
||||
{
|
||||
folder.FreeSpace = _diskProvider.GetAvailableSpace(folder.Path);
|
||||
folder.TotalSpace = _diskProvider.GetTotalSize(folder.Path);
|
||||
folder.UnmappedFolders = GetUnmappedFolders(folder.Path);
|
||||
}
|
||||
}
|
||||
|
@ -80,7 +81,6 @@ namespace NzbDrone.Core.RootFolders
|
|||
catch (Exception ex)
|
||||
{
|
||||
_logger.Error(ex, "Unable to get free space and unmapped folders for root folder {0}", folder.Path);
|
||||
folder.FreeSpace = 0;
|
||||
folder.UnmappedFolders = new List<UnmappedFolder>();
|
||||
}
|
||||
});
|
||||
|
@ -115,6 +115,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
_rootFolderRepository.Insert(rootFolder);
|
||||
|
||||
rootFolder.FreeSpace = _diskProvider.GetAvailableSpace(rootFolder.Path);
|
||||
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
|
||||
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
||||
return rootFolder;
|
||||
}
|
||||
|
@ -162,6 +163,7 @@ namespace NzbDrone.Core.RootFolders
|
|||
{
|
||||
var rootFolder = _rootFolderRepository.Get(id);
|
||||
rootFolder.FreeSpace = _diskProvider.GetAvailableSpace(rootFolder.Path);
|
||||
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
|
||||
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
||||
return rootFolder;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue