feat: add support for new artist discography page
This commit is contained in:
parent
bf80db8a9a
commit
c8e2d342c6
25 changed files with 73368 additions and 91615 deletions
|
|
@ -73,9 +73,12 @@ pub(crate) struct ShareEntityEndpoint {
|
|||
}
|
||||
|
||||
/// Response model for YouTube Music artist album page
|
||||
#[serde_as]
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[serde(rename_all = "camelCase")]
|
||||
pub(crate) struct MusicArtistAlbums {
|
||||
pub header: SimpleHeader,
|
||||
#[serde(default)]
|
||||
#[serde_as(as = "DefaultOnError")]
|
||||
pub header: Option<SimpleHeader>,
|
||||
pub contents: SingleColumnBrowseResult<Tab<SectionList<Grid>>>,
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
use serde::Deserialize;
|
||||
use serde_with::{serde_as, DefaultOnError};
|
||||
|
||||
use crate::model::UrlTarget;
|
||||
use crate::{model::UrlTarget, util};
|
||||
|
||||
/// navigation/resolve_url response model
|
||||
#[derive(Debug, Deserialize)]
|
||||
|
|
@ -152,6 +152,8 @@ pub(crate) enum PageType {
|
|||
alias = "MUSIC_PAGE_TYPE_AUDIOBOOK_ARTIST"
|
||||
)]
|
||||
Artist,
|
||||
#[serde(rename = "MUSIC_PAGE_TYPE_ARTIST_DISCOGRAPHY")]
|
||||
ArtistDiscography,
|
||||
#[serde(rename = "MUSIC_PAGE_TYPE_ALBUM", alias = "MUSIC_PAGE_TYPE_AUDIOBOOK")]
|
||||
Album,
|
||||
#[serde(
|
||||
|
|
@ -169,6 +171,9 @@ impl PageType {
|
|||
pub(crate) fn to_url_target(self, id: String) -> Option<UrlTarget> {
|
||||
match self {
|
||||
PageType::Artist | PageType::Channel => Some(UrlTarget::Channel { id }),
|
||||
PageType::ArtistDiscography => id
|
||||
.strip_prefix(util::ARTIST_DISCOGRAPHY_PREFIX)
|
||||
.map(|id| UrlTarget::Channel { id: id.to_owned() }),
|
||||
PageType::Album => Some(UrlTarget::Album { id }),
|
||||
PageType::Playlist => Some(UrlTarget::Playlist { id }),
|
||||
PageType::Unknown => None,
|
||||
|
|
@ -192,7 +197,7 @@ impl From<PageType> for MusicPageType {
|
|||
PageType::Artist => MusicPageType::Artist,
|
||||
PageType::Album => MusicPageType::Album,
|
||||
PageType::Playlist => MusicPageType::Playlist,
|
||||
PageType::Channel => MusicPageType::None,
|
||||
PageType::Channel | PageType::ArtistDiscography => MusicPageType::None,
|
||||
PageType::Unknown => MusicPageType::Unknown,
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Reference in a new issue