From 07907b2ce20024c58cb1731e0b2396dc8ec86975 Mon Sep 17 00:00:00 2001 From: Marc Plano-Lesay Date: Wed, 13 Aug 2025 14:33:12 +1000 Subject: [PATCH 1/3] chore: allow `renamed_and_removed_lints` until progenitor is updated --- src/actions/fetch_album_assets.rs | 1 + src/main.rs | 1 + 2 files changed, 2 insertions(+) diff --git a/src/actions/fetch_album_assets.rs b/src/actions/fetch_album_assets.rs index 85ba472..9704b58 100644 --- a/src/actions/fetch_album_assets.rs +++ b/src/actions/fetch_album_assets.rs @@ -7,6 +7,7 @@ use crate::{ use super::action::Action; +#[allow(dead_code)] // Will be used soon. pub struct FetchAlbumAssets { album: Album, } diff --git a/src/main.rs b/src/main.rs index 7226bc5..e311634 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,4 @@ +#![allow(renamed_and_removed_lints)] // https://github.com/oxidecomputer/progenitor/issues/1169 include!(concat!(env!("OUT_DIR"), "/client.rs")); #[cfg(test)] From 9ad599a2b4930acbea47bf2ddb7ae58ed39e37c5 Mon Sep 17 00:00:00 2001 From: Marc Plano-Lesay Date: Wed, 13 Aug 2025 14:13:34 +1000 Subject: [PATCH 2/3] feat: list assets per album --- README.md | 6 +++++ src/actions/fetch_album_assets.rs | 1 - src/args.rs | 7 ++++++ src/commands/list_album_assets.rs | 38 +++++++++++++++++++++++++++++++ src/commands/mod.rs | 1 + src/main.rs | 2 ++ 6 files changed, 54 insertions(+), 1 deletion(-) create mode 100644 src/commands/list_album_assets.rs diff --git a/README.md b/README.md index 9035733..cbdeb1d 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ video backup solution. This tool provides various utilities to manage your Immic - **List** all albums on your Immich server - **Delete** albums (all or empty ones only) - **Auto-create** albums from external libraries folder structure +- **List assets of an album** by album name ### Assets - **List** assets (all or offline only) @@ -105,6 +106,11 @@ Auto-create albums from folder structure: immich-tools albums auto-create --album-name-separator "/" ``` +List assets belonging to a specific album (by album name): +```bash +immich-tools albums list-assets --album "My Album" +``` + ### Assets List all assets: diff --git a/src/actions/fetch_album_assets.rs b/src/actions/fetch_album_assets.rs index 9704b58..85ba472 100644 --- a/src/actions/fetch_album_assets.rs +++ b/src/actions/fetch_album_assets.rs @@ -7,7 +7,6 @@ use crate::{ use super::action::Action; -#[allow(dead_code)] // Will be used soon. pub struct FetchAlbumAssets { album: Album, } diff --git a/src/args.rs b/src/args.rs index 622180e..70bde87 100644 --- a/src/args.rs +++ b/src/args.rs @@ -95,6 +95,13 @@ pub(crate) enum AlbumsCommands { /// List all albums #[serde(rename = "list")] List {}, + /// List all assets that belong to a specific album + #[serde(rename = "list-assets")] + ListAssets { + /// Name of the album to list assets for + #[arg(long)] + album: String, + }, } #[derive(Serialize, Subcommand)] diff --git a/src/commands/list_album_assets.rs b/src/commands/list_album_assets.rs new file mode 100644 index 0000000..5071b25 --- /dev/null +++ b/src/commands/list_album_assets.rs @@ -0,0 +1,38 @@ +use crate::{ + actions::{ + action::Action, fetch_album_assets::FetchAlbumAssets, fetch_all_albums::FetchAllAlbums, + }, + context::Context, +}; +use color_eyre::eyre::{eyre, Result}; +use tabled::{settings::Style, Table, Tabled}; + +#[derive(Tabled)] +struct AssetRow { + #[tabled(rename = "Path")] + original_file_path: String, +} + +pub async fn list_album_assets(ctx: Context, album_name: &str) -> Result<()> { + let albums = FetchAllAlbums::new(()).execute(&ctx).await?; + + let album = albums + .into_iter() + .find(|a| a.name == album_name) + .ok_or_else(|| eyre!("Album not found: {}", album_name))?; + + let mut assets: Vec<_> = FetchAlbumAssets::new(album) + .execute(&ctx) + .await? + .into_iter() + .map(|asset| AssetRow { + original_file_path: asset.original_path.to_string_lossy().to_string(), + }) + .collect(); + + assets.sort_by_key(|row| row.original_file_path.clone()); + + println!("{}", Table::new(assets).with(Style::rounded())); + + Ok(()) +} diff --git a/src/commands/mod.rs b/src/commands/mod.rs index 3924e81..ae72806 100644 --- a/src/commands/mod.rs +++ b/src/commands/mod.rs @@ -1,6 +1,7 @@ pub mod auto_create_albums; pub mod delete_albums; pub mod delete_assets; +pub mod list_album_assets; pub mod list_albums; pub mod list_assets; pub mod list_libraries; diff --git a/src/main.rs b/src/main.rs index e311634..05596a9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -17,6 +17,7 @@ use color_eyre::Section; use commands::auto_create_albums::auto_create_albums; use commands::delete_albums::delete_albums; use commands::delete_assets::delete_assets; +use commands::list_album_assets::list_album_assets; use commands::list_albums::list_albums; use commands::list_assets::list_assets; use commands::list_libraries::list_libraries; @@ -87,6 +88,7 @@ async fn main() -> Result<()> { } => auto_create_albums(ctx, album_name_separator.to_string()).await, AlbumsCommands::Delete { empty } => delete_albums(ctx, *empty).await, AlbumsCommands::List {} => list_albums(ctx).await, + AlbumsCommands::ListAssets { album } => list_album_assets(ctx, album).await, }, Commands::Assets { assets_command } => match assets_command { AssetsCommands::Delete { offline } => delete_assets(ctx, *offline).await, From aa18fc35255373fb71d77a201448d39b2ceb8a87 Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 13 Aug 2025 15:06:10 +1000 Subject: [PATCH 3/3] fix(deps): update rust crate reqwest to v0.12.23 --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6980646..c6b4257 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1256,7 +1256,7 @@ dependencies = [ "libc", "percent-encoding", "pin-project-lite", - "socket2 0.6.0", + "socket2 0.5.10", "system-configuration", "tokio", "tower-service", @@ -1493,7 +1493,7 @@ checksum = "e04d7f318608d35d4b61ddd75cbdaee86b023ebe2bd5a66ee0915f0bf93095a9" dependencies = [ "hermit-abi", "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -2214,9 +2214,9 @@ dependencies = [ [[package]] name = "reqwest" -version = "0.12.22" +version = "0.12.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" +checksum = "d429f34c8092b2d42c7c93cec323bb4adeb7c67698f70839adec842ec10c7ceb" dependencies = [ "base64 0.22.1", "bytes", @@ -2714,7 +2714,7 @@ dependencies = [ "getrandom 0.3.3", "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3366,7 +3366,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]]