From 5a000b2431d8d7f8a4d1fcc3343fead33c2051c4 Mon Sep 17 00:00:00 2001 From: Lucas Oskorep Date: Tue, 9 Dec 2025 11:22:28 -0500 Subject: [PATCH] fix: movies getting coellesed sometimes would select all for deletion --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/display.rs | 11 +++++++++-- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6680377..1412af0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -651,7 +651,7 @@ checksum = "4a5f13b858c8d314ee3e8f639011f7ccefe71f97f96e50151fb991f267928e2c" [[package]] name = "jelly-dedup" -version = "0.1.0" +version = "0.1.1" dependencies = [ "clap", "dotenv", diff --git a/Cargo.toml b/Cargo.toml index 1d00fb4..53b7111 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "jelly-dedup" -version = "0.1.0" +version = "0.1.1" edition = "2024" [dependencies] diff --git a/src/display.rs b/src/display.rs index 77d036c..9ce72b5 100644 --- a/src/display.rs +++ b/src/display.rs @@ -163,12 +163,19 @@ pub fn print_duplicate_movies(movie_groups: Vec>) -> Vec = Vec::new(); + let mut seen_paths: std::collections::HashSet = std::collections::HashSet::new(); + for movie in &movie_group { if let Some(media_sources) = &movie.media_sources { for source in media_sources { - all_sources.push(source.clone()); + // Only add if we haven't seen this path before + if let Some(path) = &source.path { + if seen_paths.insert(path.clone()) { + all_sources.push(source.clone()); + } + } } } }