mirror of
https://github.com/Radarr/Radarr.git
synced 2026-04-21 22:05:43 -04:00
Updated as per markus request for viewing disk space
Added two methods to Diskprovider:- getFixedDrives, getTotalSize and letting UI decide on how to display space. and changed from vent to listenTo (cherry picked from commit 5aa00cfb6498d4731d5d880c346afe747a61024e)
This commit is contained in:
committed by
Mark McDowall
parent
041e767f3d
commit
6c414929c3
@@ -3,26 +3,30 @@ using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using NzbDrone.Common;
|
||||
|
||||
namespace NzbDrone.Api.DiskSpace
|
||||
{
|
||||
public class DiskSpaceModule :NzbDroneRestModule<DiskSpaceResource>
|
||||
{
|
||||
public DiskSpaceModule():base("diskspace")
|
||||
private readonly IDiskProvider _diskProvider;
|
||||
|
||||
public DiskSpaceModule(IDiskProvider diskProvider):base("diskspace")
|
||||
{
|
||||
_diskProvider = diskProvider;
|
||||
GetResourceAll = GetFreeSpace;
|
||||
}
|
||||
|
||||
public List<DiskSpaceResource> GetFreeSpace()
|
||||
{
|
||||
return (DriveInfo.GetDrives()
|
||||
.Where(driveInfo => driveInfo.DriveType == DriveType.Fixed)
|
||||
return (_diskProvider.GetFixedDrives()
|
||||
.Select(
|
||||
driveInfo =>
|
||||
x =>
|
||||
new DiskSpaceResource()
|
||||
{
|
||||
DriveLetter = driveInfo.Name,
|
||||
FreeSpace = SizeSuffix(driveInfo.TotalFreeSpace),
|
||||
TotalSpace = SizeSuffix(driveInfo.TotalSize)
|
||||
DriveLetter = x,
|
||||
FreeSpace = _diskProvider.GetAvailableSpace(x).Value,
|
||||
TotalSpace = _diskProvider.GetTotalSize(x).Value
|
||||
})).ToList();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user