OpenMediaCenter/apiGo/main.go
lukas e985eb941c overwork most of how api works
dont transmit handler within payload
don't use oauth to gen token -- jwt instead
2021-09-16 22:38:28 +02:00

44 lines
962 B
Go

package main
import (
"fmt"
"log"
"net/http"
"openmediacenter/apiGo/api"
api2 "openmediacenter/apiGo/api/api"
"openmediacenter/apiGo/config"
"openmediacenter/apiGo/database"
"openmediacenter/apiGo/static"
"openmediacenter/apiGo/videoparser"
)
func main() {
fmt.Println("init OpenMediaCenter server")
port := 8081
config.Init()
// 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)
database.InitDB()
defer database.Close()
api.AddVideoHandlers()
api.AddSettingsHandlers()
api.AddTagHandlers()
api.AddActorsHandlers()
api.AddTvshowHandlers()
videoparser.SetupSettingsWebsocket()
// add the static files
static.ServeStaticFiles()
api2.ServerInit()
fmt.Printf("OpenMediacenter server up and running on port %d\n", port)
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", port), nil))
}