feat: simple musicDB for title
This commit is contained in:
@@ -3,6 +3,7 @@ use std::fmt::Display;
|
||||
use serde::Deserialize;
|
||||
use serde::Serialize;
|
||||
|
||||
use crate::helper::MUSIC_DB;
|
||||
use crate::helper::level_name;
|
||||
|
||||
#[derive(Default, Debug, Clone, PartialEq, Serialize, Deserialize)]
|
||||
@@ -109,6 +110,10 @@ impl Display for GetUserRatingApiResp {
|
||||
impl Display for MusicRating {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
f.write_fmt(format_args!("歌曲ID: \t{}\n", self.music_id))?;
|
||||
if let Some(info) = MUSIC_DB.as_ref().map(|db| db.get(&self.music_id)).flatten() {
|
||||
let title = &info.name;
|
||||
f.write_fmt(format_args!("曲目标题: \t{title}\n"))?;
|
||||
}
|
||||
f.write_fmt(format_args!(
|
||||
"谱面版本: \t{}\n",
|
||||
match (self.music_id / 10000) % 10 {
|
||||
|
||||
Reference in New Issue
Block a user