Don't remove the subtitles if the video is detected to be identical

This commit is contained in:
Hannes Braun 2023-01-17 21:06:57 +01:00
parent cdf054ff58
commit 21a5782825
No known key found for this signature in database
GPG key ID: 7B6557E1DFD685BE

View file

@ -298,10 +298,11 @@ impl Execute for Archive {
video_paths.push((download_video(&ctx, primary, false).await?, primary));
for additional in additionally {
let only_audio = match self.merge {
MergeBehavior::Auto => additionally
let identical_video = additionally
.iter()
.all(|a| a.stream.bandwidth == primary.stream.bandwidth),
.all(|a| a.stream.bandwidth == primary.stream.bandwidth);
let only_audio = match self.merge {
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);
}
}