Skip to content

Commit

Permalink
Fix audio syncing using wrong internal index (#407)
Browse files Browse the repository at this point in the history
  • Loading branch information
Frooastside committed May 7, 2024
1 parent ab63dcd commit 53a710a
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions crunchy-cli-core/src/utils/download.rs
Original file line number Diff line number Diff line change
Expand Up @@ -321,8 +321,6 @@ impl Downloader {
if let Some(offsets) = offsets {
let mut root_format_idx = 0;
let mut root_format_length = 0;
let mut audio_count: usize = 0;
let mut subtitle_count: usize = 0;
for (i, format) in self.formats.iter().enumerate() {
let offset = offsets.get(&i).copied().unwrap_or_default();
let format_len = format
Expand All @@ -340,15 +338,13 @@ impl Downloader {

for _ in &format.audios {
if let Some(offset) = &offsets.get(&i) {
audio_offsets.insert(audio_count, **offset);
audio_offsets.insert(i, **offset);
}
audio_count += 1
}
for _ in &format.subtitles {
if let Some(offset) = &offsets.get(&i) {
subtitle_offsets.insert(subtitle_count, **offset);
subtitle_offsets.insert(i, **offset);
}
subtitle_count += 1
}
}

Expand Down

0 comments on commit 53a710a

Please sign in to comment.