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 20:38:28 +00:00
|
|
|
api2 "openmediacenter/apiGo/api/api"
|
2021-09-06 18:20:33 +00: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"
|
2021-04-18 19:16:38 +00:00
|
|
|
"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 18:20:33 +00:00
|
|
|
config.Init()
|
|
|
|
|
2021-09-09 21:33:04 +00: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 21:33:04 +00: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 20:44:56 +00:00
|
|
|
api.AddTvshowHandlers()
|
2021-02-23 16:01:29 +00:00
|
|
|
|
2021-04-18 19:16:38 +00:00
|
|
|
videoparser.SetupSettingsWebsocket()
|
|
|
|
|
2021-04-02 17:04:15 +00:00
|
|
|
// add the static files
|
|
|
|
static.ServeStaticFiles()
|
|
|
|
|
2021-09-16 20:38:28 +00: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
|
|
|
}
|