fix: download audio with dolby codec
This commit is contained in:
parent
52744ee3bf
commit
e5a8a0e732
2 changed files with 8 additions and 6 deletions
|
|
@ -25,8 +25,8 @@ pub enum DownloadError {
|
||||||
#[error("Progressive download error: {0}")]
|
#[error("Progressive download error: {0}")]
|
||||||
Progressive(Cow<'static, str>),
|
Progressive(Cow<'static, str>),
|
||||||
/// Video could not be downloaded because of invalid player data
|
/// Video could not be downloaded because of invalid player data
|
||||||
#[error("input error: {0}")]
|
#[error("source error: {0}")]
|
||||||
Input(Cow<'static, str>),
|
Source(Cow<'static, str>),
|
||||||
/// Download target already exists
|
/// Download target already exists
|
||||||
#[error("file {0} already exists")]
|
#[error("file {0} already exists")]
|
||||||
Exists(PathBuf),
|
Exists(PathBuf),
|
||||||
|
|
|
||||||
|
|
@ -801,9 +801,9 @@ impl DownloadQuery {
|
||||||
|
|
||||||
if video.is_none() && audio.is_none() {
|
if video.is_none() && audio.is_none() {
|
||||||
if player_data.drm.is_some() {
|
if player_data.drm.is_some() {
|
||||||
return Err(DownloadError::Input("video is DRM-protected".into()));
|
return Err(DownloadError::Source("video is DRM-protected".into()));
|
||||||
}
|
}
|
||||||
return Err(DownloadError::Input("no stream found".into()));
|
return Err(DownloadError::Source("no stream found".into()));
|
||||||
}
|
}
|
||||||
|
|
||||||
let extension = match video {
|
let extension = match video {
|
||||||
|
|
@ -812,7 +812,9 @@ impl DownloadQuery {
|
||||||
Some(audio) => match audio.codec {
|
Some(audio) => match audio.codec {
|
||||||
AudioCodec::Mp4a => "m4a",
|
AudioCodec::Mp4a => "m4a",
|
||||||
AudioCodec::Opus => "opus",
|
AudioCodec::Opus => "opus",
|
||||||
_ => return Err(DownloadError::Input("unknown audio codec".into())),
|
AudioCodec::Ac3 => "ac3",
|
||||||
|
AudioCodec::Ec3 => "eac3",
|
||||||
|
_ => return Err(DownloadError::Source("unknown audio codec".into())),
|
||||||
},
|
},
|
||||||
None => unreachable!(),
|
None => unreachable!(),
|
||||||
},
|
},
|
||||||
|
|
@ -903,7 +905,7 @@ impl DownloadQuery {
|
||||||
|
|
||||||
// Tag audio file
|
// Tag audio file
|
||||||
#[cfg(feature = "audiotag")]
|
#[cfg(feature = "audiotag")]
|
||||||
if self.dl.i.audio_tag && video.is_none() {
|
if self.dl.i.audio_tag && video.is_none() && matches!(extension, "m4a" | "opus") {
|
||||||
let (details, track) = match details {
|
let (details, track) = match details {
|
||||||
Some(d) => (d, self.dl.i.rp.query().music_details(&self.video.id).await?),
|
Some(d) => (d, self.dl.i.rp.query().music_details(&self.video.id).await?),
|
||||||
None => {
|
None => {
|
||||||
|
|
|
||||||
Reference in a new issue