diff --git a/src/NzbDrone.Api/RootFolders/RootFolderResource.cs b/src/NzbDrone.Api/RootFolders/RootFolderResource.cs index 86efef529d..df55fcf1ae 100644 --- a/src/NzbDrone.Api/RootFolders/RootFolderResource.cs +++ b/src/NzbDrone.Api/RootFolders/RootFolderResource.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Linq; using NzbDrone.Api.REST; using NzbDrone.Core.RootFolders; @@ -9,6 +9,7 @@ public class RootFolderResource : RestResource { public string Path { get; set; } public long? FreeSpace { get; set; } + public long? TotalSpace { get; set; } public List UnmappedFolders { get; set; } } @@ -25,6 +26,7 @@ public static RootFolderResource ToResource(this RootFolder model) Path = model.Path, FreeSpace = model.FreeSpace, + TotalSpace = model.TotalSpace, UnmappedFolders = model.UnmappedFolders }; } @@ -48,4 +50,4 @@ public static List ToResource(this IEnumerable m return models.Select(ToResource).ToList(); } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/Datastore/TableMapping.cs b/src/NzbDrone.Core/Datastore/TableMapping.cs index 38787b0745..cea8b2898c 100644 --- a/src/NzbDrone.Core/Datastore/TableMapping.cs +++ b/src/NzbDrone.Core/Datastore/TableMapping.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.Collections.Generic; using Marr.Data; using Marr.Data.Mapping; @@ -46,7 +46,11 @@ public static void Map() RegisterMappers(); Mapper.Entity().RegisterModel("Config"); - Mapper.Entity().RegisterModel("RootFolders").Ignore(r => r.FreeSpace); + + Mapper.Entity().RegisterModel("RootFolders") + .Ignore(r => r.FreeSpace) + .Ignore(r => r.TotalSpace); + Mapper.Entity().RegisterModel("ScheduledTasks"); Mapper.Entity().RegisterDefinition("Indexers") diff --git a/src/NzbDrone.Core/RootFolders/RootFolder.cs b/src/NzbDrone.Core/RootFolders/RootFolder.cs index 8232653237..f32716b527 100644 --- a/src/NzbDrone.Core/RootFolders/RootFolder.cs +++ b/src/NzbDrone.Core/RootFolders/RootFolder.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using NzbDrone.Core.Datastore; @@ -9,7 +9,8 @@ public class RootFolder : ModelBase public string Path { get; set; } public long? FreeSpace { get; set; } + public long? TotalSpace { get; set; } public List UnmappedFolders { get; set; } } -} \ No newline at end of file +} diff --git a/src/NzbDrone.Core/RootFolders/RootFolderService.cs b/src/NzbDrone.Core/RootFolders/RootFolderService.cs index fcccb005c1..fa36728f3b 100644 --- a/src/NzbDrone.Core/RootFolders/RootFolderService.cs +++ b/src/NzbDrone.Core/RootFolders/RootFolderService.cs @@ -1,4 +1,4 @@ -using System.Linq; +using System.Linq; using System; using System.Collections.Generic; using System.IO; @@ -73,6 +73,7 @@ public List AllWithUnmappedFolders() 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 @@ public List AllWithUnmappedFolders() 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(); } }); @@ -167,8 +167,9 @@ public RootFolder Get(int id) { var rootFolder = _rootFolderRepository.Get(id); rootFolder.FreeSpace = _diskProvider.GetAvailableSpace(rootFolder.Path); + rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path); rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path); return rootFolder; } } -} \ No newline at end of file +}