Compare commits

..

1 commit

Author SHA1 Message Date
Renovate
72efbfd376 chore(deps): update actions/checkout action to v5
Some checks failed
Checking Renovate configuration / validate (pull_request) Failing after 1s
Build and test / Tests (pull_request) Failing after 2s
Build and test / Clippy (pull_request) Failing after 1s
Build and test / Build AMD64 (pull_request) Failing after 1s
Build and test / Generate Documentation (pull_request) Failing after 1s
Checking yaml / Run yamllint (pull_request) Failing after 1s
2025-08-11 23:00:49 +10:00
8 changed files with 411 additions and 475 deletions

810
Cargo.lock generated

File diff suppressed because it is too large Load diff

View file

@ -12,12 +12,12 @@ keywords = ["immich"]
ignored = ["progenitor-client", "regress"] ignored = ["progenitor-client", "regress"]
[dependencies] [dependencies]
bon = "3.0.0" bon = "2.3.0"
chrono = { version = "0.4.38", features = ["serde"] } chrono = { version = "0.4.38", features = ["serde"] }
clap = { version = "4.5.20", features = ["derive"] } clap = { version = "4.5.20", features = ["derive"] }
clap-verbosity-flag = "2.2.2" clap-verbosity-flag = "2.2.2"
color-eyre = "0.6.3" color-eyre = "0.6.3"
dialoguer = "0.12.0" dialoguer = "0.11.0"
directories = "6.0.0" directories = "6.0.0"
figment = { version = "0.10.19", features = ["env", "toml"] } figment = { version = "0.10.19", features = ["env", "toml"] }
figment_file_provider_adapter = "0.1.1" figment_file_provider_adapter = "0.1.1"

View file

@ -12,7 +12,6 @@ video backup solution. This tool provides various utilities to manage your Immic
- **List** all albums on your Immich server - **List** all albums on your Immich server
- **Delete** albums (all or empty ones only) - **Delete** albums (all or empty ones only)
- **Auto-create** albums from external libraries folder structure - **Auto-create** albums from external libraries folder structure
- **List assets of an album** by album name
### Assets ### Assets
- **List** assets (all or offline only) - **List** assets (all or offline only)
@ -106,11 +105,6 @@ Auto-create albums from folder structure:
immich-tools albums auto-create --album-name-separator "/" 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 ### Assets
List all assets: List all assets:

18
flake.lock generated
View file

@ -3,11 +3,11 @@
"flake-compat": { "flake-compat": {
"flake": false, "flake": false,
"locked": { "locked": {
"lastModified": 1747046372, "lastModified": 1696426674,
"narHash": "sha256-CIVLLkVgvHYbgI2UpXvIIBJ12HWgX+fjA8Xf8PUmqCY=", "narHash": "sha256-kvjfFW7WAETZlt09AgDn1MrtKzP7t90Vf7vypd3OL1U=",
"owner": "edolstra", "owner": "edolstra",
"repo": "flake-compat", "repo": "flake-compat",
"rev": "9100a0f413b0c601e0533d1d94ffd501ce2e7885", "rev": "0f9255e01c2351cc7d116c072cb317785dd33b33",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -57,11 +57,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1761373498, "lastModified": 1753939845,
"narHash": "sha256-Q/uhWNvd7V7k1H1ZPMy/vkx3F8C13ZcdrKjO7Jv7v0c=", "narHash": "sha256-K2ViRJfdVGE8tpJejs8Qpvvejks1+A4GQej/lBk5y7I=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "6a08e6bb4e46ff7fcbb53d409b253f6bad8a28ce", "rev": "94def634a20494ee057c76998843c015909d6311",
"type": "github" "type": "github"
}, },
"original": { "original": {
@ -80,11 +80,11 @@
] ]
}, },
"locked": { "locked": {
"lastModified": 1760663237, "lastModified": 1750779888,
"narHash": "sha256-BflA6U4AM1bzuRMR8QqzPXqh8sWVCNDzOdsxXEguJIc=", "narHash": "sha256-wibppH3g/E2lxU43ZQHC5yA/7kIKLGxVEnsnVK1BtRg=",
"owner": "cachix", "owner": "cachix",
"repo": "git-hooks.nix", "repo": "git-hooks.nix",
"rev": "ca5b894d3e3e151ffc1db040b6ce4dcc75d31c37", "rev": "16ec914f6fb6f599ce988427d9d94efddf25fe6d",
"type": "github" "type": "github"
}, },
"original": { "original": {

View file

@ -95,13 +95,6 @@ pub(crate) enum AlbumsCommands {
/// List all albums /// List all albums
#[serde(rename = "list")] #[serde(rename = "list")]
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)] #[derive(Serialize, Subcommand)]

View file

@ -1,38 +0,0 @@
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(())
}

View file

@ -1,7 +1,6 @@
pub mod auto_create_albums; pub mod auto_create_albums;
pub mod delete_albums; pub mod delete_albums;
pub mod delete_assets; pub mod delete_assets;
pub mod list_album_assets;
pub mod list_albums; pub mod list_albums;
pub mod list_assets; pub mod list_assets;
pub mod list_libraries; pub mod list_libraries;

View file

@ -16,7 +16,6 @@ use color_eyre::Section;
use commands::auto_create_albums::auto_create_albums; use commands::auto_create_albums::auto_create_albums;
use commands::delete_albums::delete_albums; use commands::delete_albums::delete_albums;
use commands::delete_assets::delete_assets; use commands::delete_assets::delete_assets;
use commands::list_album_assets::list_album_assets;
use commands::list_albums::list_albums; use commands::list_albums::list_albums;
use commands::list_assets::list_assets; use commands::list_assets::list_assets;
use commands::list_libraries::list_libraries; use commands::list_libraries::list_libraries;
@ -87,7 +86,6 @@ async fn main() -> Result<()> {
} => auto_create_albums(ctx, album_name_separator.to_string()).await, } => auto_create_albums(ctx, album_name_separator.to_string()).await,
AlbumsCommands::Delete { empty } => delete_albums(ctx, *empty).await, AlbumsCommands::Delete { empty } => delete_albums(ctx, *empty).await,
AlbumsCommands::List {} => list_albums(ctx).await, AlbumsCommands::List {} => list_albums(ctx).await,
AlbumsCommands::ListAssets { album } => list_album_assets(ctx, album).await,
}, },
Commands::Assets { assets_command } => match assets_command { Commands::Assets { assets_command } => match assets_command {
AssetsCommands::Delete { offline } => delete_assets(ctx, *offline).await, AssetsCommands::Delete { offline } => delete_assets(ctx, *offline).await,