feat(readarr): fetch Readarr disk space and expose it on the CLI
Add ReadarrEvent::GetDiskSpace, mapped to GET /diskspace, and get_readarr_diskspace, which stores the result on ReadarrData for the root folder and system views. Surface it as `managarr readarr list disk-space`, matching the other three servarrs. Readarr returns a label field on some records that DiskSpace does not model; serde drops it, so the CLI prints only the path and the free and total space, as it does for the other three servarrs.
This commit is contained in:
7 files changed
+242
-2
No files matched your search
@@ -1,4 +1,4 @@
|
||||
use crate::models::servarr_models::SystemStatus;
|
||||
use crate::models::servarr_models::{DiskSpace, SystemStatus};
|
||||
use crate::network::readarr_network::ReadarrEvent;
|
||||
use crate::network::{Network, RequestMethod};
|
||||
use anyhow::Result;
|
||||
@@ -9,6 +9,23 @@ use log::info;
|
||||
mod readarr_system_network_tests;
|
||||
|
||||
impl Network<'_, '_> {
|
||||
pub(in crate::network::readarr_network) async fn get_readarr_diskspace(
|
||||
&mut self,
|
||||
) -> Result<Vec<DiskSpace>> {
|
||||
info!("Fetching Readarr disk space");
|
||||
let event = ReadarrEvent::GetDiskSpace;
|
||||
|
||||
let request_props = self
|
||||
.request_props_from(event, RequestMethod::Get, None::<()>, None, None)
|
||||
.await;
|
||||
|
||||
self
|
||||
.handle_request::<(), Vec<DiskSpace>>(request_props, |disk_space_vec, mut app| {
|
||||
app.data.readarr_data.disk_space_vec = disk_space_vec;
|
||||
})
|
||||
.await
|
||||
}
|
||||
|
||||
pub(in crate::network::readarr_network) async fn get_readarr_status(
|
||||
&mut self,
|
||||
) -> Result<SystemStatus> {
|
||||
|
||||
Reference in new issue
Block a user