Browse Source

Update saving beatmap information not working properly

Morgan Bazalgette 1 year ago
parent
commit
0723f05b14
3 changed files with 11 additions and 6 deletions
  1. 3
    0
      beatmap_finder.go
  2. 1
    1
      data_json.go
  3. 7
    5
      main.go

+ 3
- 0
beatmap_finder.go View File

@@ -71,6 +71,9 @@ func BeatmapFinder() {
71 71
 			var b DataBeatmapSet
72 72
 			json.Unmarshal(data, &b)
73 73
 			if b.LastUpdate.Equal(beatmapsF[0].LastUpdate.GetTime()) {
74
+				if fixBeatmaps {
75
+					UpdateBeatmapSet(beatmapsF, b.HasVideo)
76
+				}
74 77
 				continue
75 78
 			}
76 79
 		case strings.Index(err.Error(), "no such file or directory") != -1:

+ 1
- 1
data_json.go View File

@@ -65,7 +65,7 @@ func UpdateBeatmapSet(set []osuapi.Beatmap, hasVideo bool) error {
65 65
 	}
66 66
 	for _, beatmap := range set {
67 67
 		dBeatmap := DataBeatmap{
68
-			BeatmapID:        set[0].BeatmapID,
68
+			BeatmapID:        beatmap.BeatmapID,
69 69
 			ParentSetID:      set[0].BeatmapSetID,
70 70
 			DiffName:         beatmap.DiffName,
71 71
 			FileMD5:          beatmap.FileMD5,

+ 7
- 5
main.go View File

@@ -20,16 +20,18 @@ import (
20 20
 const mirrorVersion = "0.3.0"
21 21
 
22 22
 var (
23
-	cf   config
24
-	c    *osuapi.Client
25
-	nc   *http.Client
26
-	wg   sync.WaitGroup
27
-	sets []int
23
+	cf          config
24
+	c           *osuapi.Client
25
+	nc          *http.Client
26
+	wg          sync.WaitGroup
27
+	sets        []int
28
+	fixBeatmaps bool
28 29
 )
29 30
 
30 31
 func init() {
31 32
 	var setsRaw string
32 33
 	flag.StringVar(&setsRaw, "sets", "", "beatmapsets to download. If not passed, it downloads everything.")
34
+	flag.BoolVar(&fixBeatmaps, "fb", false, "enable to always execute UpdateBeatmaps, even when the beatmap already exists")
33 35
 	flag.Parse()
34 36
 	if setsRaw != "" {
35 37
 		is := strings.Split(setsRaw, ",")

Loading…
Cancel
Save