feat: add music charts

This commit is contained in:
ThetaDev 2022-12-01 12:56:58 +01:00
parent e063c04821
commit f20ea693a6
19 changed files with 128651 additions and 42 deletions

View file

@ -57,6 +57,7 @@ pub async fn download_testfiles(project_root: &Path) {
music_radio_cont(&testfiles).await;
music_new_albums(&testfiles).await;
music_new_videos(&testfiles).await;
music_charts(&testfiles).await;
}
const CLIENT_TYPES: [ClientType; 5] = [
@ -827,3 +828,21 @@ async fn music_new_videos(testfiles: &Path) {
let rp = rp_testfile(&json_path);
rp.query().music_new_videos().await.unwrap();
}
async fn music_charts(testfiles: &Path) {
for (name, id) in [
("default", None),
("US", Some("US")),
("unavailable", Some("MY")),
] {
let mut json_path = testfiles.to_path_buf();
json_path.push("music_charts");
json_path.push(&format!("charts_{}.json", name));
if json_path.exists() {
continue;
}
let rp = rp_testfile(&json_path);
rp.query().music_charts(id).await.unwrap();
}
}

View file

@ -183,6 +183,7 @@ impl FromStr for Country {
let mut code_langs = r#"/// Available languages
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum Language {
"#
.to_owned();
@ -190,6 +191,7 @@ pub enum Language {
let mut code_countries = r#"/// Available countries
#[derive(Copy, Clone, Debug, Serialize, Deserialize, PartialEq, Eq, PartialOrd, Ord, Hash)]
#[serde(rename_all = "UPPERCASE")]
#[non_exhaustive]
pub enum Country {
"#
.to_owned();