Skip to content

Commit 982d86c

Browse files
committed
Fix parsing exported portals
Requires manual preparation with sed
1 parent beb5760 commit 982d86c

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

import.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ func readFile(fileName string, separator rune) ([][]string, error) {
1919
return nil, err
2020
}
2121

22+
//sed -i 's/\\\"/""/g' Portal_Export.csv
2223
//sed -i 's/None\tNone$/None/g' game_log.tsv
2324

2425
// Initialize our csv reader
@@ -48,10 +49,10 @@ func getVisitsAndCaptures() []byte {
4849
var err error
4950

5051
portals := make([]json.RawMessage, 0)
51-
if fileContents, err = readFile("dump/Portal_Export.csv", ','); err != nil {
52-
log.Println("Did not find scraped portal list, ignoring…")
52+
if fileContents, err = readFile("dump/Portal_Export.csv", ','); err != nil || len(fileContents) == 0 {
53+
log.Println("Could not parse scraped portal list, ignoring…")
5354
} else {
54-
portals = processData(fileContents, portals, func(line []string) bool {
55+
portals = processData(fileContents[1:], portals, func(line []string) bool {
5556
return true
5657
})
5758
}

0 commit comments

Comments
 (0)