Exemplo n.º 1
0
func TestWebManager(t *testing.T) {
	l4g.LoadConfiguration("../../config/logConfig.xml")

	configFile, readConfigFileErr := os.Open("../../config/overwall.config")
	if readConfigFileErr != nil {
		t.Fatal(readConfigFileErr)
	}
	decoder := json.NewDecoder(configFile)
	config := &Config{}
	decoder.Decode(&config)

	fmt.Printf("config info:\n%+v\n", config)

	opt := news.Option{}
	opt.SpeechFileDir = config.SpeechFileDir
	opt.SpeechCache = config.CacheSize
	opt.SentenceLen = config.OneSentenceLen
	opt.MaxGenVoiceTask = config.MaxGenVoiceTask
	opt.EasyreadUsername = config.EasyreadUsername
	opt.EasyreadPwd = config.EasyreadPwd
	opt.GenVoiceFile = true

	fmt.Printf("opt info:\n%+v\n", opt)

	newsManager := news.NewNewsManager(opt)
	webManager := NewWebManager(newsManager, "8787", "/home/noah/workspace/OverWall/config/chimes1.mp3")
	webManager.StartServer()
}
Exemplo n.º 2
0
func main() {
	//logConfig := new(string)
	//*logConfig = "../../config/logConfig.xml"
	//configPath := new(string)
	//*configPath = "../../config/overwall.config"

	runtime.GOMAXPROCS(runtime.NumCPU())

	flag.Parse()
	l4g.LoadConfiguration(*logConfig)
	l4g.Debug("MAXPROCS: %d", runtime.GOMAXPROCS(0))
	defer time.Sleep(2 * time.Second) // make sure log4go output the log

	configFile, readConfigFileErr := os.Open(*configPath)
	if readConfigFileErr != nil {
		l4g.Error("Read config error: %s", readConfigFileErr.Error())
		return
	}
	decoder := json.NewDecoder(configFile)
	config := &web.Config{}
	decoder.Decode(&config)

	l4g.Info("Config info: %+v", config)

	opt := news.Option{}
	opt.SpeechFileDir = config.SpeechFileDir
	opt.SpeechCache = config.CacheSize
	opt.SentenceLen = config.OneSentenceLen
	opt.MaxGenVoiceTask = config.MaxGenVoiceTask
	opt.EasyreadUsername = config.EasyreadUsername
	opt.EasyreadPwd = config.EasyreadPwd
	opt.GenVoiceFile = true

	newsManager := news.NewNewsManager(opt)
	webManager := web.NewWebManager(newsManager, "8787", config)
	webManager.StartServer()
}