Skip to content

Commit 8ee9b58

Browse files
committed
implement processors in Java
1 parent d1db9c7 commit 8ee9b58

15 files changed

Lines changed: 1732 additions & 143 deletions

File tree

Dockerfile

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,10 @@ RUN apt-get update
66
RUN apt-get install bzip2
77

88
# Install nodejs for log processing
9-
ARG NODE_VERSION=20.10.0
10-
ARG TARGETPLATFORM
11-
RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="arm64"; else ARCH="x64"; fi \
12-
&& curl https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.gz | tar -xz -C /usr/local --strip-components 1
9+
# ARG NODE_VERSION=20.10.0
10+
# ARG TARGETPLATFORM
11+
# RUN if [ "$TARGETPLATFORM" = "linux/arm64" ]; then ARCH="arm64"; else ARCH="x64"; fi \
12+
# && curl https://nodejs.org/dist/v$NODE_VERSION/node-v$NODE_VERSION-linux-$ARCH.tar.gz | tar -xz -C /usr/local --strip-components 1
1313

1414
WORKDIR /usr/src/parser
1515
ADD . /usr/src/parser

pom.xml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,7 @@
1717
</developer>
1818
</developers>
1919
<properties>
20-
<maven.compiler.target>1.8</maven.compiler.target>
21-
<maven.compiler.source>1.8</maven.compiler.source>
20+
<maven.compiler.release>21</maven.compiler.release>
2221
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
2322
</properties>
2423
<repositories>

processors/createParsedDataBlob.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ function createParsedDataBlob(entries, matchId) {
2525
parsedData.teamfights = processTeamfights(expanded, meta);
2626
logConsole.timeEnd('teamfights');
2727
logConsole.time('draft');
28-
parsedData.draft_timings = processDraftTimings(entries, meta);
28+
parsedData.draft_timings = [];
2929
logConsole.timeEnd('draft');
3030
logConsole.time('pauses');
3131
parsedData.pauses = processPauses(entries);

processors/populate.mjs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,11 @@ function populate(e, container, meta) {
2222
case 'CHAT_MESSAGE_ROSHAN_KILL':
2323
case 'CHAT_MESSAGE_MINIBOSS_KILL':
2424
case 'building_kill':
25-
container.objectives.push(JSON.parse(JSON.stringify(e)));
25+
const copy = JSON.parse(JSON.stringify(e));
26+
if (copy.key) {
27+
copy.key = String(copy.key);
28+
}
29+
container.objectives.push(copy);
2630
break;
2731
case 'ability_levels':
2832
meta.ability_levels[e.unit] = {
@@ -94,7 +98,7 @@ function populate(e, container, meta) {
9498
) {
9599
arrEntry = {
96100
time: e.time,
97-
key: e.key,
101+
key: String(e.key),
98102
};
99103
const maxCharges = e.key === 'tango' ? 3 : 1;
100104
if (e.type === 'purchase_log' && e.charges > maxCharges) {
@@ -141,7 +145,7 @@ function populate(e, container, meta) {
141145
t[ability][target] += damage;
142146
} else if (typeof t === 'object') {
143147
// add it to hash of counts
144-
e.value = e.value || 1;
148+
e.value = e.value != null ? e.value : 1;
145149
if (t[e.key]) {
146150
t[e.key] += e.value;
147151
} else {

processors/processTeamfights.mjs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ function processTeamfights(entries, meta) {
8787
const { x, y } = intervalState[r.time][r.slot];
8888
// fill in the copy
8989
r.type = 'deaths_pos';
90-
r.key = JSON.stringify([x, y]);
90+
r.key = JSON.stringify([Math.round(x), Math.round(y)]);
9191
r.posData = true;
9292
populate(r, tf);
9393
// increment death count for this hero

scripts/test.sh

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
#curl localhost:5600 --data-binary "@/datadrive/odota-parser/7355186741_1742953546.dem"
4-
#curl localhost:5600 --data-binary "@/datadrive/odota-parser/6298221747_1156784242.dem"
3+
curl localhost:5600 --data-binary "@/home/howardc/parser/8583844960_1679394786.dem"
4+
curl "localhost:5600?blob" --data-binary "@/home/howardc/parser/8583844960_1679394786.dem"
55

6-
curl localhost:5600/blob?replay_url=http://replay185.valve.net/570/8583844960_1679394786.dem.bz2
6+
curl localhost:5600/blob?replay_url=http://replay271.valve.net/570/8623065989_1426557301.dem.bz2

0 commit comments

Comments
 (0)