Files
OpenMediaCenter/apiGo/main.go
T

44 lines
962 B
Go
Raw Normal View History

2021-02-23 16:01:29 +00:00
package main
import (
"fmt"
2021-04-02 17:04:15 +00:00
"log"
"net/http"
2021-02-23 16:01:29 +00:00
"openmediacenter/apiGo/api"
2021-09-16 22:38:28 +02:00
api2 "openmediacenter/apiGo/api/api"
2021-09-06 20:20:33 +02:00
"openmediacenter/apiGo/config"
2021-02-23 16:01:29 +00:00
"openmediacenter/apiGo/database"
2021-04-02 17:04:15 +00:00
"openmediacenter/apiGo/static"
"openmediacenter/apiGo/videoparser"
2021-02-23 16:01:29 +00:00
)
func main() {
fmt.Println("init OpenMediaCenter server")
2021-04-02 17:04:15 +00:00
port := 8081
2021-02-23 16:01:29 +00:00
2021-09-06 20:20:33 +02:00
config.Init()
2021-09-09 23:33:04 +02:00
// todo some verbosity logger or sth
fmt.Printf("Use verbose output: %t\n", config.GetConfig().General.VerboseLogging)
fmt.Printf("Videopath prefix: %s\n", config.GetConfig().General.ReindexPrefix)
2021-02-23 16:01:29 +00:00
2021-09-09 23:33:04 +02:00
database.InitDB()
2021-02-23 16:01:29 +00:00
defer database.Close()
api.AddVideoHandlers()
api.AddSettingsHandlers()
api.AddTagHandlers()
api.AddActorsHandlers()
2021-04-16 22:44:56 +02:00
api.AddTvshowHandlers()
2021-02-23 16:01:29 +00:00
videoparser.SetupSettingsWebsocket()
2021-04-02 17:04:15 +00:00
// add the static files
static.ServeStaticFiles()
2021-09-16 22:38:28 +02:00
api2.ServerInit()
2021-04-02 17:04:15 +00:00
fmt.Printf("OpenMediacenter server up and running on port %d\n", port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
2021-02-23 16:01:29 +00:00
}