Skip to content

Commit dcfbd30

Browse files
authored
Merge pull request #88 from Kaszanas/dev
[PR] Preparing 2.1.0
2 parents 0a0f292 + 6a8997c commit dcfbd30

49 files changed

Lines changed: 1794 additions & 2165 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/PULL_REQUEST_TEMPLATE.MD

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
## Description
33
<!--- Describe your changes in detail -->
44

5-
## Related IssueS
5+
## Related Issues
66
<!--- This project only accepts pull requests related to open issues -->
77
<!--- If suggesting a new feature or change, please discuss it in an issue first -->
88
<!--- If fixing a bug, there should be an issue describing it with steps to reproduce -->

.github/workflows/docker_images.yml

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ name: Publish Docker Image
22

33
on:
44
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
- dev
59
release:
610
types: [published]
711

@@ -25,11 +29,12 @@ jobs:
2529
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81
2630
with:
2731
images: |
28-
kaszanas/sc2infoextractorgo
32+
kaszanas/sc2infoextractorgo
2933
- name: Build and Push Docker images
3034
uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0
3135
with:
3236
context: .
37+
file: ./docker/Dockerfile
3338
push: true
3439
tags: ${{ steps.meta.outputs.tags }}
35-
labels: ${{ steps.meta.outputs.labels }}
40+
labels: ${{ steps.meta.outputs.labels }}

README.md

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -75,57 +75,58 @@ The following flags are available:
7575

7676
```
7777
-help
78-
Show command usage
78+
Show command usage
7979
-game_mode_filter int
80-
Specifies which game mode should be included from the processed files
81-
in a format of a binary flag: AllGameModes: 0b11111111 (default 0b11111111) (default 255)
80+
Specifies which game mode should be included from the processed files
81+
in a format of a binary flag: AllGameModes: 0b11111111 (default 0b11111111) (default 255)
8282
-input string
83-
Input directory where .SC2Replay files are held. (default "./replays/input")
83+
Input directory where .SC2Replay files are held. (default "./replays/input")
8484
-log_dir string
85-
Specifies directory which will hold the logging information. (default "./logs/")
85+
Specifies directory which will hold the logging information. (default "./logs/")
8686
-log_level int
87-
Specifies a log level from 1-7:
88-
Panic - 1, Fatal - 2,
89-
Error - 3, Warn - 4,
90-
Info - 5, Debug - 6,
91-
Trace - 7 (default 4)
87+
Specifies a log level from 1-7:
88+
Panic - 1, Fatal - 2,
89+
Error - 3, Warn - 4,
90+
Info - 5, Debug - 6,
91+
Trace - 7 (default 4)
9292
-maps_directory string
93-
Directory where the maps will be downloaded as a result of the
94-
replay processing. (default "./maps/")
93+
Directory where the maps will be downloaded as a result of the replay processing. (default "./maps/")
9594
-max_procs int
96-
Specifies the number of logic cores of a processor that will be used for processing (default runtime.NumCPU()). (default 24)
95+
Specifies the number of logic cores of a processor that will be used for processing (default runtime.NumCPU()). (default 24)
9796
-number_of_packages int
98-
Provide a number of zip packages to be created and compressed
99-
into a zip archive. Please remember that this number needs to be lower
100-
than the number of processed files. If set to 0, will ommit the
101-
zip packaging and output .json directly to drive. (default 1)
97+
Provide a number of zip packages to be created and compressed
98+
into a zip archive. Please remember that this number needs to be lower
99+
than the number of processed files. If set to 0, will ommit the
100+
zip packaging and output .json directly to drive. (default 1)
102101
-only_map_download
103-
Flag specifying if the tool is supposed to only download
104-
the maps and not process the replays.
102+
Flag specifying if the tool is supposed to only download
103+
the maps and not process the replays.
105104
-output string
106-
Output directory where compressed zip packages will be saved. (default "./replays/output")
105+
Output directory where compressed zip packages will be saved. (default "./replays/output")
107106
-perform_chat_anonymization
108-
Flag, specifying if the chat anonymization should be performed.
107+
Flag, specifying if the chat anonymization should be performed.
109108
-perform_cleanup
110-
Flag specifying if the tool is supposed to perform the cleaning
111-
functions within the processing pipeline.
109+
Flag specifying if the tool is supposed to perform the cleaning
110+
functions within the processing pipeline.
112111
-perform_filtering
113-
Flag, specifying if the pipeline ought to verify different hard coded game modes.
114-
If set to false completely bypasses the filtering.
112+
Flag, specifying if the pipeline ought to verify different hard coded game modes.
113+
If set to false completely bypasses the filtering.
115114
-perform_integrity_checks
116-
Flag specifying if the software is supposed to check the hardcoded
117-
integrity checks for the provided replays
115+
Flag specifying if the software is supposed to check the hardcoded
116+
integrity checks for the provided replays
118117
-perform_player_anonymization
119-
Flag specifying if the tool is supposed to perform player anonymization
120-
functions within the processing pipeline.
121-
If set to true please remember to download and run
122-
an anonymization server: https://doi.org/10.5281/zenodo.5138313
118+
Flag specifying if the tool is supposed to perform player anonymization
119+
functions within the processing pipeline.
120+
If set to true please remember to download and run
121+
an anonymization server: https://doi.org/10.5281/zenodo.5138313
123122
-perform_validity_checks
124-
Flag, specifying if the tool is supposed to use hardcoded validity checks
125-
and verify if the replay file variables are within 'common sense' ranges.
123+
Flag, specifying if the tool is supposed to use hardcoded validity checks
124+
and verify if the replay file variables are within 'common sense' ranges.
125+
-skip_map_download
126+
Flag specifying if the tool is supposed to skip the map download
126127
-with_cpu_profiler string
127-
Set path to the file where pprof cpu profiler will save its information.
128-
If this is empty no profiling is performed.
128+
Set path to the file where pprof cpu profiler will save its information.
129+
If this is empty no profiling is performed.
129130
```
130131
131132

dataproc/anonymize.go

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ func anonymizeReplay(
4141
grpcAnonymizer *GRPCAnonymizer,
4242
performChatAnonymizationBool bool) bool {
4343

44-
log.Info("Entered anonymizeReplay()")
44+
log.Debug("Entered anonymizeReplay()")
4545

4646
// Anonymization of Chat events that might
4747
// contain sensitive information for research purposes:
@@ -59,7 +59,7 @@ func anonymizeReplay(
5959
return false
6060
}
6161

62-
log.Info("Finished anonymizeReplay()")
62+
log.Debug("Finished anonymizeReplay()")
6363
return true
6464
}
6565

@@ -82,7 +82,7 @@ type GRPCAnonymizer struct {
8282
// grpcConnect initializes a connection to a specified in settings grpc server.
8383
func (anonymizer *GRPCAnonymizer) grpcDialConnect() bool {
8484

85-
log.Info("Entered GRPCAnonymizer.grpcDialConnect()")
85+
log.Debug("Entered GRPCAnonymizer.grpcDialConnect()")
8686

8787
// Set up a connection to the server:
8888
conn, err := grpc.NewClient(settings.GrpcServerAddress,
@@ -97,7 +97,7 @@ func (anonymizer *GRPCAnonymizer) grpcDialConnect() bool {
9797

9898
anonymizer.Connection = conn
9999

100-
log.Info("Finished GRPCAnonymizer.grpcDialConnect()")
100+
log.Debug("Finished GRPCAnonymizer.grpcDialConnect()")
101101
return true
102102

103103
}
@@ -112,7 +112,7 @@ func (anonymizer *GRPCAnonymizer) grpcInitializeClient() {
112112
// in the cache and if it is not it calls grpcAnonymizeID.
113113
func (anonymizer *GRPCAnonymizer) anonymizeToon(toonString string) (string, bool) {
114114

115-
log.Info("Entered GRPCAnonymizer.anonymizeToon()")
115+
log.Debug("Entered GRPCAnonymizer.anonymizeToon()")
116116

117117
// Check if the toon is already in cache not to spam the connection with requests:
118118
val, ok := anonymizer.Cache[toonString]
@@ -130,7 +130,7 @@ func (anonymizer *GRPCAnonymizer) anonymizeToon(toonString string) (string, bool
130130
return "", false
131131
}
132132
anonymizer.Cache[toonString] = anonymizedID
133-
log.Info("Finished GRPCAnonymizer.anonymizeToon()")
133+
log.Debug("Finished GRPCAnonymizer.anonymizeToon()")
134134

135135
return anonymizedID, true
136136
}
@@ -143,7 +143,7 @@ func grpcGetAnonymizeID(
143143
grpcConnection *grpc.ClientConn,
144144
) (string, bool) {
145145

146-
log.Info("Entered grpcAnonymize()")
146+
log.Debug("Entered grpcAnonymize()")
147147

148148
// Contact the server and print out its response:
149149
ctx, cancel := context.WithTimeout(context.Background(), time.Second*10)
@@ -159,7 +159,7 @@ func grpcGetAnonymizeID(
159159
log.WithField("gRPC_response", result.AnonymizedID).
160160
Debug("Received anonymized ID for a player.")
161161

162-
log.Info("Finished grpcAnonymize()")
162+
log.Debug("Finished grpcAnonymize()")
163163
return result.AnonymizedID, true
164164
}
165165

@@ -198,15 +198,15 @@ func anonymizePlayers(
198198
log.WithField("toonDescMapAnonymized", replayData.ToonPlayerDescMap).
199199
Debug("Replaced toonDescMap with anonymized version")
200200

201-
log.Info("Finished anonymizePlayers()")
201+
log.Debug("Finished anonymizePlayers()")
202202
return true
203203
}
204204

205205
// anonymizeMessageEvents checks against settings.UnusedMessageEvents
206206
// and creates a new clean version without specified events.
207207
func anonimizeMessageEvents(replayData *replay_data.CleanedReplay) bool {
208208

209-
log.Info("Entered anonimizeMessageEvents().")
209+
log.Debug("Entered anonimizeMessageEvents().")
210210
var anonymizedMessageEvents []s2prot.Struct
211211
for _, event := range replayData.MessageEvents {
212212
eventType := event["evtTypeName"].(string)
@@ -217,6 +217,6 @@ func anonimizeMessageEvents(replayData *replay_data.CleanedReplay) bool {
217217

218218
replayData.MessageEvents = anonymizedMessageEvents
219219

220-
log.Info("Finished anonymizeMessageEvents()")
220+
log.Debug("Finished anonymizeMessageEvents()")
221221
return true
222222
}

dataproc/checks_filtering.go

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ import (
99
// filterGameModes performs the check against a binary 0b1111111 getGameModeFlag
1010
// to verify if the currently processed replay game mode is correct.
1111
func filterGameModes(replayData *rep.Rep, getGameModeFlag int) bool {
12-
log.Info("Entered filterGameModes()")
12+
log.Debug("Entered filterGameModes()")
1313

1414
for _, value := range gameModeList {
1515
// If we want to include games with game mode `value`,
@@ -21,7 +21,7 @@ func filterGameModes(replayData *rep.Rep, getGameModeFlag int) bool {
2121
}
2222
}
2323

24-
log.Info("Finished filterGameModes()")
24+
log.Debug("Finished filterGameModes()")
2525

2626
// The game did not match any active filters, return false.
2727
return false
@@ -34,7 +34,7 @@ func checkGameParameters(
3434
replayData *rep.Rep,
3535
gameInfoFilter VerifyGameInfo) bool {
3636

37-
log.Info("Entered checkGameParameters()")
37+
log.Debug("Entered checkGameParameters()")
3838

3939
// Verifying if the number of players matches:
4040
if !checkNumberOfPlayers(replayData, gameInfoFilter.maxPlayers) {
@@ -72,7 +72,7 @@ func checkGameParameters(
7272
return false
7373
}
7474

75-
log.Info("Finished checkGameParameters()")
75+
log.Debug("Finished checkGameParameters()")
7676
return true
7777

7878
}
@@ -91,3 +91,12 @@ func checkNumberOfPlayers(replayData *rep.Rep, requiredNumber int) bool {
9191
return numberOfPlayers == requiredNumber
9292

9393
}
94+
95+
// gameis1v1Ranked checks if the replay is a 1v1 ranked game.
96+
func gameIs1v1Ranked(replayData *rep.Rep) bool {
97+
98+
isAmm := replayData.InitData.GameDescription.GameOptions.Amm()
99+
isCompetitive := replayData.InitData.GameDescription.GameOptions.CompetitiveOrRanked()
100+
isTwoPlayers := len(replayData.Metadata.Players()) == 2
101+
return isAmm && isCompetitive && isTwoPlayers
102+
}

dataproc/checks_integrity.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010
// matches against structures with redundant information.
1111
func checkIntegrity(replayData *rep.Rep) (bool, string) {
1212

13-
log.Info("Entered checkIntegrity()")
13+
log.Debug("Entered checkIntegrity()")
1414
maxPlayers := replayData.InitData.GameDescription.MaxPlayers()
1515
replayDetails := replayData.Details
1616

dataproc/checks_validity.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ type VerifyGameInfo struct {
5959
// in order to verify if the file is within "common sense" values.
6060
func validate1v1Replay(replayData *rep.Rep) bool {
6161

62-
log.Info("Entered validateData()")
62+
log.Debug("Entered validateData()")
6363
playerList := replayData.Metadata.Players()
6464

6565
if len(playerList) == 2 {
@@ -94,15 +94,15 @@ func validate1v1Replay(replayData *rep.Rep) bool {
9494
return false
9595
}
9696

97-
log.Info("Finished validateData(), returning")
97+
log.Debug("Finished validateData(), returning")
9898
return true
9999
}
100100

101101
// checkBlizzardMap verifies if the currently processed
102102
// replay was played using a Blizzard official map.
103103
func checkBlizzardMap(replayData *rep.Rep) bool {
104104

105-
log.Info("Entered checkBlizzardMap()")
105+
log.Debug("Entered checkBlizzardMap()")
106106

107107
gameDescIsBlizzardMap := replayData.InitData.GameDescription.IsBlizzardMap()
108108
detailsIsBlizzardMap := replayData.Details.IsBlizzardMap()
@@ -114,6 +114,6 @@ func checkBlizzardMap(replayData *rep.Rep) bool {
114114
return false
115115
}
116116

117-
log.Info("Finished checkBlizzardMap(), returning")
117+
log.Debug("Finished checkBlizzardMap(), returning")
118118
return true
119119
}

0 commit comments

Comments
 (0)