Skip to content
This repository has been archived by the owner on Mar 18, 2023. It is now read-only.

Commit

Permalink
✨ Implement the initial replay parser
Browse files Browse the repository at this point in the history
Hi, WoT inspector!
  • Loading branch information
eigenein committed Dec 2, 2022
1 parent 481ce8f commit 7184546
Show file tree
Hide file tree
Showing 6 changed files with 184 additions and 24 deletions.
117 changes: 93 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,21 @@ mongodb = { version = "2.3.1", features = ["zstd-compression", "bson-chrono-0_4"
num-traits = "0.2.15"
phf = { version = "0.11.0", features = ["macros"] }
poem = { version = "1.3.47", features = ["anyhow", "i18n", "cookie"] }
prost = "0.11.3"
rand = "0.8.4"
reqwest = { version = "0.11.11", default-features = false, features = ["rustls-tls", "gzip", "brotli", "deflate", "json"] }
sentry = { version = "0.29.0", default-features = false, features = ["reqwest", "rustls", "backtrace", "contexts", "panic", "tracing", "anyhow"] }
serde = { version = "1.0.137", features = ["derive"] }
serde_bytes = "0.11.7"
serde_json = "1.0.87"
serde-pickle = "1.1.1"
serde_with = { version = "1.14.0", features = ["chrono"] }
statrs = "0.16.0"
tokio = { version = "1.21.2", features = ["rt-multi-thread", "time", "signal"] }
tracing = { version = "0.1.34", features = ["std"] }
tracing-futures = { version = "0.2.5", features = ["tokio", "futures-03"] }
tracing-subscriber = { version = "0.3.11", features = ["fmt", "env-filter"] }
zip = { version = "0.6.3", default-features = false, features = ["deflate"] }

[dev-dependencies]
poem = { version = "1.3.47", features = ["test"], default-features = false }
Expand Down
1 change: 1 addition & 0 deletions src/database/mongodb/models/rating_snapshot.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ impl RatingSnapshot {
realm,
account_id: account_info.id,
season: account_info.stats.rating.current_season,
#[allow(deprecated)]
date: account_info.last_battle_time.date().and_hms(0, 0, 0),
open_rating: account_info.stats.rating.mm_rating,
close_rating: account_info.stats.rating.mm_rating,
Expand Down
2 changes: 2 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ mod math;
mod opts;
mod prelude;
mod tankopedia;
mod test_replay;
pub mod wargaming;
mod web;

Expand All @@ -46,6 +47,7 @@ async fn run_subcommand(opts: Opts) -> Result {
Subcommand::CrawlAccounts(opts) => crawler::crawl_accounts(opts).await,
Subcommand::ImportTankopedia(opts) => tankopedia::import(opts).await,
Subcommand::Web(opts) => web::run(opts).await,
Subcommand::TestReplay(opts) => test_replay::run(opts),
};
info!(elapsed = ?start_instant.elapsed(), "the command has finished");
if let Err(error) = &result {
Expand Down
9 changes: 9 additions & 0 deletions src/opts.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
//! CLI options.
use std::num::NonZeroU32;
use std::path::PathBuf;

use clap::builder::EnumValueParser;
use clap::Parser;
Expand Down Expand Up @@ -34,6 +35,7 @@ pub enum Subcommand {
Crawl(CrawlerOpts),
CrawlAccounts(CrawlAccountsOpts),
ImportTankopedia(ImportTankopediaOpts),
TestReplay(TestReplayOpts),
Web(WebOpts),
}

Expand Down Expand Up @@ -210,3 +212,10 @@ pub struct InternalConnectionOpts {
)]
pub mongodb_uri: String,
}

/// Parses a replay file.
#[derive(Parser)]
pub struct TestReplayOpts {
#[structopt(value_name = "REPLAY_PATH")]
pub path: PathBuf,
}
Loading

0 comments on commit 7184546

Please sign in to comment.