Update dependencies

This commit is contained in:
bytedream 2022-12-16 10:09:41 +01:00
parent f254df3bb3
commit cc9342cd0a
9 changed files with 373 additions and 768 deletions

View file

@ -332,7 +332,7 @@ async fn formats_from_series(
.locale
.clone()
.into_iter()
.filter(|l| !season.iter().any(|s| &s.metadata.audio_locale == l))
.filter(|l| !season.iter().any(|s| s.metadata.audio_locales.contains(l)))
.collect::<Vec<Locale>>();
for not_present in not_present_audio {
error!(
@ -346,7 +346,7 @@ async fn formats_from_series(
// remove all seasons with the wrong audio for the current iterated season number
seasons.retain(|s| {
s.metadata.season_number != season.first().unwrap().metadata.season_number
|| archive.locale.contains(&s.metadata.audio_locale)
|| archive.locale.iter().any(|l| s.metadata.audio_locales.contains(l))
})
}
@ -355,7 +355,7 @@ async fn formats_from_series(
BTreeMap::new();
for season in series.seasons().await? {
if !url_filter.is_season_valid(season.metadata.season_number)
|| !archive.locale.contains(&season.metadata.audio_locale)
|| !archive.locale.iter().any(|l| season.metadata.audio_locales.contains(l))
{
continue;
}

View file

@ -290,7 +290,7 @@ async fn formats_from_series(
// check if the current iterated season has the specified audio language
if !season
.iter()
.any(|s| s.metadata.audio_locale == download.audio)
.any(|s| s.metadata.audio_locales.contains(&download.audio))
{
error!(
"Season {} of series {} is not available with {} audio",
@ -303,7 +303,7 @@ async fn formats_from_series(
// remove all seasons with the wrong audio for the current iterated season number
seasons.retain(|s| {
s.metadata.season_number != season.first().unwrap().metadata.season_number
|| s.metadata.audio_locale == download.audio
|| s.metadata.audio_locales.contains(&download.audio)
})
}
@ -322,7 +322,7 @@ async fn formats_from_season(
season: Media<Season>,
url_filter: &UrlFilter,
) -> Result<Option<Vec<Format>>> {
if season.metadata.audio_locale != download.audio {
if !season.metadata.audio_locales.contains(&download.audio) {
error!(
"Season {} ({}) is not available with {} audio",
season.metadata.season_number, season.title, download.audio

View file

@ -1,7 +1,6 @@
use crate::utils::context::Context;
use anyhow::{bail, Result};
use crunchyroll_rs::media::{Resolution, VariantData, VariantSegment};
use isahc::AsyncReadResponseExt;
use log::{debug, LevelFilter};
use std::borrow::{Borrow, BorrowMut};
use std::collections::BTreeMap;
@ -26,7 +25,7 @@ pub fn find_resolution(
}
pub async fn download_segments(
_ctx: &Context,
ctx: &Context,
writer: &mut impl Write,
message: Option<String>,
variant_data: VariantData,
@ -34,7 +33,7 @@ pub async fn download_segments(
let segments = variant_data.segments().await?;
let total_segments = segments.len();
let client = Arc::new(variant_data.download_client());
let client = Arc::new(ctx.crunchy.client());
let count = Arc::new(Mutex::new(0));
let amount = Arc::new(Mutex::new(0));
@ -132,7 +131,7 @@ pub async fn download_segments(
let thread_count = count.clone();
join_set.spawn(async move {
for (i, segment) in thread_segments.into_iter().enumerate() {
let mut response = thread_client.get_async(&segment.url).await?;
let response = thread_client.get(&segment.url).send().await?;
let mut buf = response.bytes().await?.to_vec();
*thread_amount.lock().unwrap() += buf.len();