feat(codegen): collected video duration samples

This commit is contained in:
ThetaDev 2023-05-06 21:12:49 +02:00
parent 19781eab36
commit 800073df48
14 changed files with 7325 additions and 1449 deletions

View file

@ -1,14 +1,15 @@
use std::collections::BTreeMap;
use std::fmt::Write;
use std::path::Path;
use path_macro::path;
use reqwest::header;
use reqwest::Client;
use serde::Deserialize;
use serde_with::serde_as;
use serde_with::VecSkipError;
use crate::util::Text;
use crate::model::Text;
use crate::util::SRC_DIR;
#[serde_as]
#[derive(Clone, Debug, Deserialize)]
@ -137,7 +138,7 @@ struct LanguageCountryCommand {
hl: String,
}
pub async fn generate_locales(project_root: &Path) {
pub async fn generate_locales() {
let (languages, countries) = get_locales().await;
let code_head = r#"// This file is automatically generated. DO NOT EDIT.
@ -288,8 +289,7 @@ pub enum Country {
"{code_head}\n{code_langs}\n{code_countries}\n{code_lang_array}\n{code_country_array}\n{code_lang_names}\n{code_country_names}\n{code_foot}"
);
let mut target_path = project_root.to_path_buf();
target_path.push("src/param/locale.rs");
let target_path = path!(*SRC_DIR / "param" / "locale.rs");
std::fs::write(target_path, code).unwrap();
}