chore: collect structured GetUserMusicApiResp
This commit is contained in:
@@ -80,21 +80,27 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
|
||||
match command {
|
||||
Commands::MusicDetail { user_id, format } => {
|
||||
let music_detail = get_user_all_music(&client, user_id).await?;
|
||||
let details = music_detail
|
||||
.user_music_list
|
||||
.iter()
|
||||
.map(|m| &m.user_music_detail_list)
|
||||
.flatten();
|
||||
|
||||
match (human_readable, format) {
|
||||
(true, _) => {
|
||||
for detail in &music_detail {
|
||||
let mut count = 0;
|
||||
for detail in details {
|
||||
println!("{detail}");
|
||||
println!("----------");
|
||||
count += 1;
|
||||
}
|
||||
|
||||
println!("共查询到 {} 条记录!", music_detail.len());
|
||||
println!("共查询到 {count} 条记录!");
|
||||
}
|
||||
(false, RatingFormat::Origin) => json_display(music_detail)?,
|
||||
(false, RatingFormat::DxRatingNet) => {
|
||||
let dx_export = Vec::from_iter(
|
||||
music_detail
|
||||
.iter()
|
||||
details
|
||||
.map(|music| {
|
||||
DxMusicRecord::try_from(music).inspect_err(|e| {
|
||||
warn!("failed to process {}: {e}", music.music_id)
|
||||
|
||||
Reference in New Issue
Block a user