aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/download_count.js22
1 files changed, 19 insertions, 3 deletions
diff --git a/scripts/download_count.js b/scripts/download_count.js
index dc8fe32..47dae4b 100644
--- a/scripts/download_count.js
+++ b/scripts/download_count.js
@@ -2,10 +2,13 @@ const https = require("https");
let link = "/repos/0neGal/viper/releases";
-let count = 0;
+let releases = {};
+let total_count = 0;
let parse_release = (release) => {
let assets = release.assets;
+ let name = release.name + ":";
+
for (let i = 0; i < assets.length; i++) {
// dont count blockmaps
if (assets[i].name.match("blockmap")) {
@@ -17,8 +20,20 @@ let parse_release = (release) => {
case "latest.yml":
case "latest-linux.yml":
continue;
+
default:
- count += assets[i].download_count;
+ let downloads = assets[i].download_count;
+
+ if (! releases[name]) {
+ releases[name] = 0;
+ }
+
+ total_count += downloads;
+ releases[name] += downloads;
+ }
+
+ if (i == assets.length - 1) {
+ console.log(name, releases[name]);
}
}
}
@@ -29,7 +44,8 @@ let parse_json = (json) => {
parse_release(json[i]);
}
- console.log("Download count:", count);
+ console.log();
+ console.log("Total download count:", total_count);
}
https.get({