From 21a5782825e41449a0d9fe62a72775907a22cbb5 Mon Sep 17 00:00:00 2001 From: Hannes Braun Date: Tue, 17 Jan 2023 21:06:57 +0100 Subject: [PATCH] Don't remove the subtitles if the video is detected to be identical --- crunchy-cli-core/src/cli/archive.rs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/crunchy-cli-core/src/cli/archive.rs b/crunchy-cli-core/src/cli/archive.rs index e0fc9b0..2c06ca0 100644 --- a/crunchy-cli-core/src/cli/archive.rs +++ b/crunchy-cli-core/src/cli/archive.rs @@ -298,10 +298,11 @@ impl Execute for Archive { video_paths.push((download_video(&ctx, primary, false).await?, primary)); for additional in additionally { + let identical_video = additionally + .iter() + .all(|a| a.stream.bandwidth == primary.stream.bandwidth); let only_audio = match self.merge { - MergeBehavior::Auto => additionally - .iter() - .all(|a| a.stream.bandwidth == primary.stream.bandwidth), + MergeBehavior::Auto => identical_video, MergeBehavior::Audio => true, MergeBehavior::Video => false, }; @@ -312,8 +313,8 @@ impl Execute for Archive { video_paths.push((path, additional)) } - // Remove subtitles of deleted video - if only_audio { + // Remove subtitles of forcibly deleted video + if matches!(self.merge, MergeBehavior::Audio) && !identical_video { subtitles.retain(|s| s.episode_id != additional.episode_id); } }