forked from l3lackShark/gosumemory
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.go
50 lines (45 loc) · 1.45 KB
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package main
import (
"flag"
"fmt"
"log"
"os"
"runtime"
"time"
"github.com/l3lackShark/gosumemory/db"
"github.com/l3lackShark/gosumemory/memory"
"github.com/l3lackShark/gosumemory/pp"
"github.com/l3lackShark/gosumemory/updater"
"github.com/l3lackShark/gosumemory/web"
)
func main() {
updateTimeFlag := flag.Int("update", 100, "How fast should we update the values? (in milliseconds)")
shouldWeUpdate := flag.Bool("autoupdate", true, "Should we auto update the application?")
isRunningInWINE := flag.Bool("wine", false, "Running under WINE?")
songsFolderFlag := flag.String("path", "auto", `Path to osu! Songs directory ex: /mnt/ps3drive/osu\!/Songs`)
flag.Parse()
memory.UpdateTime = *updateTimeFlag
memory.SongsFolderPath = *songsFolderFlag
memory.UnderWine = *isRunningInWINE
if runtime.GOOS != "windows" && memory.SongsFolderPath == "auto" {
log.Fatalln("Please specify path to osu!Songs (see --help)")
}
if *shouldWeUpdate == true {
updater.DoSelfUpdate()
}
go memory.Init()
err := db.InitDB()
if err != nil {
log.Println(err)
time.Sleep(5 * time.Second)
os.Exit(1)
}
go web.SetupStructure()
go web.HTTPServer()
go web.SetupRoutes()
go pp.GetData()
go pp.GetFCData()
fmt.Println("WARNING: Mania pp calcualtion is experimental and only works if you choose mania gamemode in the SongSelect!")
fmt.Println("Initialization complete, you can now visit http://localhost:24050 or add it as a browser source in OBS")
pp.GetEditorData()
}