feat: dump fetched b50

This commit is contained in:
mokurin000
2025-08-02 22:02:52 +08:00
parent c85c2101b7
commit 3e1a0185fa
3 changed files with 16 additions and 6 deletions

View File

@@ -96,6 +96,8 @@ pub enum Commands {
}, },
#[cfg(feature = "fetchall")] #[cfg(feature = "fetchall")]
ListAllUserDump {}, ListAllUserDump {},
#[cfg(feature = "fetchall")]
ScrapeAllB50Dump {},
Logout { Logout {
#[arg(short, long)] #[arg(short, long)]

View File

@@ -255,12 +255,6 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
cached_concurrent_fetch::<GetUserPreviewApi>(user_ids, &client, concurrency, PLAYERS) cached_concurrent_fetch::<GetUserPreviewApi>(user_ids, &client, concurrency, PLAYERS)
.await?; .await?;
} }
#[cfg(feature = "fetchall")]
Commands::ListAllUserDump {} => {
use crate::{cache::PLAYERS, utils::helpers::dump_cache};
dump_cache::<GetUserPreviewApiResp>("players.json", PLAYERS)?;
}
#[cfg(feature = "fetchall")] #[cfg(feature = "fetchall")]
Commands::ScrapeAllB50 { Commands::ScrapeAllB50 {
@@ -287,6 +281,19 @@ async fn main() -> Result<(), Box<dyn snafu::Error>> {
.await?; .await?;
} }
#[cfg(feature = "fetchall")]
Commands::ListAllUserDump {} => {
use crate::{cache::PLAYERS, utils::helpers::dump_cache};
dump_cache::<GetUserPreviewApiResp>("players.json", PLAYERS)?;
}
#[cfg(feature = "fetchall")]
Commands::ScrapeAllB50Dump {} => {
use crate::{cache::PLAYER_B50, utils::helpers::dump_cache};
dump_cache::<GetUserRatingApiResp>("b50.json", PLAYER_B50)?;
}
Commands::Userdata { user_id } => { Commands::Userdata { user_id } => {
let action = async |_| match Sdgb1_50::request::<_, GetUserDataApiResp>( let action = async |_| match Sdgb1_50::request::<_, GetUserDataApiResp>(
&client, &client,

View File

@@ -20,6 +20,7 @@ use bincode::{BorrowDecode, Encode, borrow_decode_from_slice};
use crate::{EARLY_QUIT, cache}; use crate::{EARLY_QUIT, cache};
#[allow(unused)]
pub fn read_cache_keys( pub fn read_cache_keys(
definition: TableDefinition<'_, u32, Vec<u8>>, definition: TableDefinition<'_, u32, Vec<u8>>,
) -> Result<Vec<u32>, Box<dyn snafu::Error>> { ) -> Result<Vec<u32>, Box<dyn snafu::Error>> {