remove deprecated best_av_format since it useless for youtube now
This commit is contained in:
parent
39726c281f
commit
1b9770235d
1 changed files with 0 additions and 42 deletions
|
|
@ -115,38 +115,6 @@ impl YtDlpInfo {
|
|||
}
|
||||
}
|
||||
|
||||
#[deprecated(
|
||||
since = "0.1.1",
|
||||
note = "for YouTube download audio and video separately"
|
||||
)]
|
||||
pub fn best_av_format(&self) -> Option<&YtDlpFormat> {
|
||||
let format = self
|
||||
.formats
|
||||
.iter()
|
||||
.filter_map(|f| {
|
||||
if f.vcodec.is_some() && f.acodec.is_some() {
|
||||
Some(VideoFormat {
|
||||
format: &f,
|
||||
format_note: f.format_note.as_ref()?,
|
||||
width: f.width?,
|
||||
height: f.height?,
|
||||
vbr: f.vbr?,
|
||||
})
|
||||
} else {
|
||||
None
|
||||
}
|
||||
})
|
||||
.max_by_key(|f| (f.width, f.height));
|
||||
|
||||
match format {
|
||||
Some(vf) => Some(vf.format),
|
||||
None => {
|
||||
event!(Level::ERROR, "no av format for {}", self.id);
|
||||
None
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pub fn best_audio_format(&self) -> Option<&YtDlpFormat> {
|
||||
let format = self
|
||||
.formats
|
||||
|
|
@ -317,16 +285,6 @@ mod tests {
|
|||
use super::YtDlp;
|
||||
use std::env;
|
||||
|
||||
#[tokio::test]
|
||||
async fn best_av_format() {
|
||||
dotenv::from_filename(".env.test").unwrap();
|
||||
let info = YtDlp::load_info(env::var("TEST_URL").unwrap().as_str())
|
||||
.await
|
||||
.unwrap();
|
||||
let video = info.best_av_format().unwrap();
|
||||
assert_eq!(video.format_id, "22");
|
||||
}
|
||||
|
||||
#[tokio::test]
|
||||
async fn best_audio_format() {
|
||||
dotenv::from_filename(".env.test").unwrap();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue