aboutsummaryrefslogtreecommitdiff
path: root/backend/parser/parser.go
diff options
context:
space:
mode:
authorArda Serdar Pektezol <1669855+pektezol@users.noreply.github.com>2024-11-21 18:12:07 +0300
committerGitHub <noreply@github.com>2024-11-21 18:12:07 +0300
commitcff5e845c75e9e2751a2c1f01f8ae3fbf24f0e7d (patch)
treeb5b55b7bc02e94e6d77787328cc52e1e49efcf1a /backend/parser/parser.go
parentfeat/rankings: optimize Steam ID comparison (#236) (diff)
downloadlphub-1.0.3.tar.gz
lphub-1.0.3.tar.bz2
lphub-1.0.3.zip
feat/backend: gdrive to backblaze migration, improve create record (#237)v1.0.3
Diffstat (limited to 'backend/parser/parser.go')
-rw-r--r--backend/parser/parser.go10
1 files changed, 3 insertions, 7 deletions
diff --git a/backend/parser/parser.go b/backend/parser/parser.go
index 19cd677..e39616c 100644
--- a/backend/parser/parser.go
+++ b/backend/parser/parser.go
@@ -2,8 +2,8 @@ package parser
2 2
3import ( 3import (
4 "errors" 4 "errors"
5 "io"
5 "math" 6 "math"
6 "os"
7 "regexp" 7 "regexp"
8 "strconv" 8 "strconv"
9 "strings" 9 "strings"
@@ -22,13 +22,9 @@ type Result struct {
22} 22}
23 23
24// Don't try to understand it, feel it. 24// Don't try to understand it, feel it.
25func ProcessDemo(filePath string) (Result, error) { 25func ProcessDemo(demoFile io.Reader) (Result, error) {
26 var result Result 26 var result Result
27 file, err := os.Open(filePath) 27 reader := bitreader.NewReader(demoFile, true)
28 if err != nil {
29 return Result{}, err
30 }
31 reader := bitreader.NewReader(file, true)
32 demoFileStamp := reader.TryReadString() 28 demoFileStamp := reader.TryReadString()
33 demoProtocol := reader.TryReadSInt32() 29 demoProtocol := reader.TryReadSInt32()
34 networkProtocol := reader.TryReadSInt32() 30 networkProtocol := reader.TryReadSInt32()