Add a libraries command and scan subcommand

This commit is contained in:
Marc Plano-Lesay 2024-11-17 15:31:12 +01:00
parent 2eb4e391c2
commit af1af8dce1
Signed by: kernald
GPG key ID: 66A41B08CC62A6CF
9 changed files with 182 additions and 1 deletions

View file

@ -1,6 +1,7 @@
pub mod delete_assets;
pub mod list_assets;
pub mod missing_date_of_birth;
pub mod scan_libraries;
pub mod server_features;
pub mod server_version;
pub mod sync_date_of_birth;

View file

@ -0,0 +1,17 @@
use color_eyre::eyre::Result;
use log::*;
use crate::actions::action::Action;
use crate::actions::scan_library::ScanLibrary;
use crate::{actions::fetch_all_libraries::FetchAllLibraries, context::Context};
pub async fn scan_libraries(ctx: Context) -> Result<()> {
let libraries = FetchAllLibraries::new(()).execute(&ctx).await?;
for library in libraries {
debug!("Scanning {}", library.name);
ScanLibrary::new(library).execute(&ctx).await?;
}
Ok(())
}