/
main.go
55 lines (40 loc) · 1.2 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
51
52
53
54
55
package main
import (
"log"
"github.com/BurntSushi/toml"
"github.com/acgshare/acgsh/db"
"github.com/acgshare/acgsh/rpc"
"github.com/acgshare/acgsh/search"
)
var adminTwisterUsername string
var config acgshConfig
const (
max_post_id = 99999999
)
type acgshConfig struct {
TwisterUsername string
TwisterServer string
HttpServerPort string
}
func main() {
log.SetFlags(log.LstdFlags | log.Lshortfile)
// Load config
if _, err := toml.DecodeFile("acgsh.conf", &config); err != nil {
log.Fatalln("Error: can not load acgsh.conf", err)
return
}
adminTwisterUsername = config.TwisterUsername
//Init DB
db.Init()
defer db.Close()
//Init search engine
search.Init()
rpc.SetAddress(config.TwisterServer)
go runSyncTimeLine()
//btih, category, fileSize, title, ok := retrieveMagnetInfo("#acgsh maGnet:? dn = =& xt=urn:btih:A3TU7P63QSNXXSYN2PDQYDZV4IYRU2CG& x.C = 動畫 &xl=123124&dn=[诸神字幕组][高校星歌剧][High School Star Musical][12][繁日双语字幕][720P][CHT MP4]")
//println(btih, category, fileSize, title, ok)
startHttpServer()
}
// todo: httpjsonrpcClient unmarshal json error
// todo: httpjsonrpcClient no connection error
// todo: httpjsonrpcClient log.fatal modify