mirror of
https://github.com/Radarr/Radarr.git
synced 2024-09-17 15:02:34 +02:00
parent
33cc228ac1
commit
032fc68892
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using NzbDrone.Api.REST;
|
using NzbDrone.Api.REST;
|
||||||
using NzbDrone.Core.RootFolders;
|
using NzbDrone.Core.RootFolders;
|
||||||
@ -9,6 +9,7 @@ public class RootFolderResource : RestResource
|
|||||||
{
|
{
|
||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
public long? FreeSpace { get; set; }
|
public long? FreeSpace { get; set; }
|
||||||
|
public long? TotalSpace { get; set; }
|
||||||
|
|
||||||
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
||||||
}
|
}
|
||||||
@ -25,6 +26,7 @@ public static RootFolderResource ToResource(this RootFolder model)
|
|||||||
|
|
||||||
Path = model.Path,
|
Path = model.Path,
|
||||||
FreeSpace = model.FreeSpace,
|
FreeSpace = model.FreeSpace,
|
||||||
|
TotalSpace = model.TotalSpace,
|
||||||
UnmappedFolders = model.UnmappedFolders
|
UnmappedFolders = model.UnmappedFolders
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@ -48,4 +50,4 @@ public static List<RootFolderResource> ToResource(this IEnumerable<RootFolder> m
|
|||||||
return models.Select(ToResource).ToList();
|
return models.Select(ToResource).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using Marr.Data;
|
using Marr.Data;
|
||||||
using Marr.Data.Mapping;
|
using Marr.Data.Mapping;
|
||||||
@ -87,7 +87,11 @@ public static void Map()
|
|||||||
RegisterMappers();
|
RegisterMappers();
|
||||||
|
|
||||||
Mapper.Entity<Config>().RegisterModel("Config");
|
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<ScheduledTask>().RegisterModel("ScheduledTasks");
|
||||||
|
|
||||||
Mapper.Entity<IndexerDefinition>().RegisterDefinition("Indexers")
|
Mapper.Entity<IndexerDefinition>().RegisterDefinition("Indexers")
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NzbDrone.Core.Datastore;
|
using NzbDrone.Core.Datastore;
|
||||||
|
|
||||||
|
|
||||||
@ -9,7 +9,8 @@ public class RootFolder : ModelBase
|
|||||||
public string Path { get; set; }
|
public string Path { get; set; }
|
||||||
|
|
||||||
public long? FreeSpace { get; set; }
|
public long? FreeSpace { get; set; }
|
||||||
|
public long? TotalSpace { get; set; }
|
||||||
|
|
||||||
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
public List<UnmappedFolder> UnmappedFolders { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
@ -76,14 +76,15 @@ public List<RootFolder> AllWithUnmappedFolders()
|
|||||||
if (folder.Path.IsPathValid() && _diskProvider.FolderExists(folder.Path))
|
if (folder.Path.IsPathValid() && _diskProvider.FolderExists(folder.Path))
|
||||||
{
|
{
|
||||||
folder.FreeSpace = _diskProvider.GetAvailableSpace(folder.Path);
|
folder.FreeSpace = _diskProvider.GetAvailableSpace(folder.Path);
|
||||||
|
folder.TotalSpace = _diskProvider.GetTotalSize(folder.Path);
|
||||||
folder.UnmappedFolders = GetUnmappedFolders(folder.Path);
|
folder.UnmappedFolders = GetUnmappedFolders(folder.Path);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//We don't want an exception to prevent the root folders from loading in the UI, so they can still be deleted
|
//We don't want an exception to prevent the root folders from loading in the UI, so they can still be deleted
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
_logger.Error(ex, "Unable to get free space and unmapped folders for root folder: " + folder.Path);
|
|
||||||
folder.FreeSpace = 0;
|
folder.FreeSpace = 0;
|
||||||
|
_logger.Error(ex, "Unable to get free space and unmapped folders for root folder {0}", folder.Path);
|
||||||
folder.UnmappedFolders = new List<UnmappedFolder>();
|
folder.UnmappedFolders = new List<UnmappedFolder>();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -211,8 +212,9 @@ public RootFolder Get(int id)
|
|||||||
{
|
{
|
||||||
var rootFolder = _rootFolderRepository.Get(id);
|
var rootFolder = _rootFolderRepository.Get(id);
|
||||||
rootFolder.FreeSpace = _diskProvider.GetAvailableSpace(rootFolder.Path);
|
rootFolder.FreeSpace = _diskProvider.GetAvailableSpace(rootFolder.Path);
|
||||||
|
rootFolder.TotalSpace = _diskProvider.GetTotalSize(rootFolder.Path);
|
||||||
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
rootFolder.UnmappedFolders = GetUnmappedFolders(rootFolder.Path);
|
||||||
return rootFolder;
|
return rootFolder;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user