Compare commits

..

2 commits

Author SHA1 Message Date
b4ca16caf8 fix: accept empty music continuations 2023-03-13 16:36:21 +01:00
8aa2bfcf9e fix(cli): extend playlists 2023-03-13 16:13:27 +01:00
3 changed files with 19 additions and 6 deletions

View file

@ -588,10 +588,20 @@ async fn main() {
}
UrlTarget::Playlist { id } => {
if music {
let playlist = rp.query().music_playlist(&id).await.unwrap();
let mut playlist = rp.query().music_playlist(&id).await.unwrap();
playlist
.tracks
.extend_limit(rp.query(), limit)
.await
.unwrap();
print_data(&playlist, format, pretty);
} else {
let playlist = rp.query().playlist(&id).await.unwrap();
let mut playlist = rp.query().playlist(&id).await.unwrap();
playlist
.videos
.extend_limit(rp.query(), limit)
.await
.unwrap();
print_data(&playlist, format, pretty);
}
}

View file

@ -136,11 +136,11 @@ impl MapResponse<Paginator<MusicItem>> for response::MusicContinuation {
let mut continuations = Vec::new();
match self.continuation_contents {
response::music_item::ContinuationContents::MusicShelfContinuation(mut shelf) => {
Some(response::music_item::ContinuationContents::MusicShelfContinuation(mut shelf)) => {
mapper.map_response(shelf.contents);
continuations.append(&mut shelf.continuations);
}
response::music_item::ContinuationContents::SectionListContinuation(contents) => {
Some(response::music_item::ContinuationContents::SectionListContinuation(contents)) => {
for c in contents.contents {
match c {
response::music_item::ItemSection::MusicShelfRenderer(mut shelf) => {
@ -154,7 +154,9 @@ impl MapResponse<Paginator<MusicItem>> for response::MusicContinuation {
}
}
}
response::music_item::ContinuationContents::PlaylistPanelContinuation(mut panel) => {
Some(response::music_item::ContinuationContents::PlaylistPanelContinuation(
mut panel,
)) => {
continuations.append(&mut panel.continuations);
mapper.add_warnings(&mut panel.contents.warnings);
panel.contents.c.into_iter().for_each(|item| {
@ -163,6 +165,7 @@ impl MapResponse<Paginator<MusicItem>> for response::MusicContinuation {
}
});
}
None => {}
}
let map_res = mapper.items();

View file

@ -298,7 +298,7 @@ impl From<MusicThumbnailRenderer> for Vec<model::Thumbnail> {
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct MusicContinuation {
pub continuation_contents: ContinuationContents,
pub continuation_contents: Option<ContinuationContents>,
}
#[derive(Debug, Deserialize)]