-
Notifications
You must be signed in to change notification settings - Fork 1
/
subtitler.go
53 lines (41 loc) · 1.35 KB
/
subtitler.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
package main
import (
"github.com/kfur/subtitler/app"
"github.com/kfur/subtitler/app/route"
"github.com/kfur/subtitler/app/shared/jsonconfig"
"github.com/kfur/subtitler/app/shared/recaptcha"
"github.com/kfur/subtitler/app/shared/server"
"github.com/kfur/subtitler/app/shared/view"
"github.com/kfur/subtitler/app/shared/view/plugin"
c "github.com/kfur/subtitler/config"
"log"
"os"
"runtime"
)
// *****************************************************************************
// Application Logic
// *****************************************************************************
func init() {
// Verbose logging with file name and line number
log.SetFlags(log.Lshortfile)
// Use all CPU cores
runtime.GOMAXPROCS(runtime.NumCPU())
// Load the configuration file
jsonconfig.Load("config"+string(os.PathSeparator)+"config.json", c.Config)
}
func main() {
// Configure the Google reCAPTCHA prior to loading view plugins
recaptcha.Configure(c.Config.Recaptcha)
// Init IBM text to speech service
app.InitRecogniseService()
// Setup the views
view.Configure(c.Config.View)
view.LoadTemplates(c.Config.Template.Root, c.Config.Template.Children)
view.LoadPlugins(
plugin.TagHelper(c.Config.View),
plugin.NoEscape(),
plugin.PrettyTime(),
recaptcha.Plugin())
// Start the listener
server.Run(route.LoadHTTP(), route.LoadHTTPS(), c.Config.Server)
}