Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

use format idx instead of audio idx #407

Merged
merged 1 commit into from
May 7, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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