You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
|
|
package main
|
|
|
|
|
|
|
|
import (
|
|
|
|
"flag"
|
|
|
|
"fmt"
|
|
|
|
"git.noahlan.cn/northlan/ntools-go/logger"
|
|
|
|
"live-gateway/bilibili"
|
|
|
|
"live-gateway/config"
|
|
|
|
"sync"
|
|
|
|
)
|
|
|
|
|
|
|
|
var configFile = flag.String("f", "./config.yml", "the config file")
|
|
|
|
|
|
|
|
func main() {
|
|
|
|
flag.Parse()
|
|
|
|
|
|
|
|
config.Init(*configFile)
|
|
|
|
|
|
|
|
if err := logger.InitLogger(&config.Config.Log.File, &config.Config.Log.Console); err != nil {
|
|
|
|
fmt.Println("初始化logger错误", err)
|
|
|
|
}
|
|
|
|
defer logger.Sync()
|
|
|
|
|
|
|
|
var wg sync.WaitGroup
|
|
|
|
|
|
|
|
if config.Config.Bilibili.Enabled {
|
|
|
|
wg.Add(1)
|
|
|
|
bLive := bilibili.NewLiveBilibili()
|
|
|
|
go func() {
|
|
|
|
if err := bLive.Serve(); err != nil {
|
|
|
|
logger.SLog.Error("err", err)
|
|
|
|
wg.Done()
|
|
|
|
}
|
|
|
|
}()
|
|
|
|
}
|
|
|
|
wg.Wait()
|
|
|
|
}
|