aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Schadt <kingdread@gmx.de>2020-08-17 14:36:49 +0200
committerDaniel Schadt <kingdread@gmx.de>2020-08-17 14:36:49 +0200
commita85c84a7fe4f557f22781bf64271733d33278da2 (patch)
treec941db4aac5fd921869fc055db27f7686b7a4d94
parentec37b994114226829841c250d1170ce4053d99a7 (diff)
downloadezau-a85c84a7fe4f557f22781bf64271733d33278da2.tar.gz
ezau-a85c84a7fe4f557f22781bf64271733d33278da2.tar.bz2
ezau-a85c84a7fe4f557f22781bf64271733d33278da2.zip
add a minimum_duration setting
-rw-r--r--README.md5
-rw-r--r--ezau-sample.toml5
-rw-r--r--src/config.rs3
-rw-r--r--src/main.rs4
4 files changed, 17 insertions, 0 deletions
diff --git a/README.md b/README.md
index d6ba347..8d340ea 100644
--- a/README.md
+++ b/README.md
@@ -50,6 +50,11 @@ upload = false
# (optional)
upload_unknown = false
+# Minimum duration (in milliseconds) for logs to be uploaded.
+# Set to 0 to upload all logs.
+# (optional)
+minimum_duration = 0
+
# How often uploading a log should be retried when it failed.
# Note that this does not include the first try, so a value of 0 means "try it
# once".
diff --git a/ezau-sample.toml b/ezau-sample.toml
index 00f8d73..e22083b 100644
--- a/ezau-sample.toml
+++ b/ezau-sample.toml
@@ -8,6 +8,11 @@ upload = false
# (optional)
upload_unknown = false
+# Minimum duration (in milliseconds) for logs to be uploaded.
+# Set to 0 to upload all logs.
+# (optional)
+minimum_duration = 0
+
# How often uploading a log should be retried when it failed.
# Note that this does not include the first try, so a value of 0 means "try it
# once".
diff --git a/src/config.rs b/src/config.rs
index 805a2c3..47d6de7 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -11,6 +11,9 @@ pub struct Config {
/// Flag indicating whether logs with an unknown boss should be uploaded.
#[serde(default)]
pub upload_unknown: bool,
+ /// Minimum log duration in milliseconds for uploads.
+ #[serde(default)]
+ pub minimum_duration: u64,
/// How often the upload to dps.report should be retried.
#[serde(default)]
pub retries: u32,
diff --git a/src/main.rs b/src/main.rs
index d5cee18..4052d59 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -201,6 +201,10 @@ fn should_upload(config: &Config, log: &Log) -> bool {
if log.encounter() == Some(Boss::Skorvald) && !log.is_cm() {
return false;
}
+ // Only upload logs that are long enough
+ if log.span() < config.minimum_duration {
+ return false;
+ }
true
}