make tvshow navlink and pages and backend disableable with a command line parameter
This commit is contained in:
@ -53,6 +53,7 @@ func getSettingsFromDB() {
|
||||
* @apiSuccess {string} MediacenterName overall name of the mediacenter
|
||||
* @apiSuccess {string} Pasword new server password (-1 if no password set)
|
||||
* @apiSuccess {bool} DarkMode Darkmode enabled?
|
||||
* @apiSuccess {bool} TVShowEnabled is are TVShows enabled
|
||||
*/
|
||||
AddHandler("loadInitialData", SettingsNode, func(info *HandlerInfo) []byte {
|
||||
sett := settings.LoadSettings()
|
||||
@ -63,6 +64,7 @@ func getSettingsFromDB() {
|
||||
MediacenterName string
|
||||
VideoPath string
|
||||
TVShowPath string
|
||||
TVShowEnabled bool
|
||||
}
|
||||
|
||||
regexMatchUrl := regexp.MustCompile("^http(|s)://([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}\\.([0-9]){1,3}:[0-9]{1,5}")
|
||||
@ -77,6 +79,7 @@ func getSettingsFromDB() {
|
||||
MediacenterName: sett.MediacenterName,
|
||||
VideoPath: serverVideoPath,
|
||||
TVShowPath: serverTVShowPath,
|
||||
TVShowEnabled: settings.TVShowsEnabled(),
|
||||
}
|
||||
|
||||
str, _ := json.Marshal(res)
|
||||
|
@ -3,9 +3,15 @@ package api
|
||||
import (
|
||||
"fmt"
|
||||
"openmediacenter/apiGo/database"
|
||||
"openmediacenter/apiGo/database/settings"
|
||||
)
|
||||
|
||||
func AddTvshowHandlers() {
|
||||
// do not add handlers if tvshows not enabled
|
||||
if !settings.TVShowsEnabled() {
|
||||
return
|
||||
}
|
||||
|
||||
/**
|
||||
* @api {post} /api/tvshow [getTVShows]
|
||||
* @apiDescription get all available tv shows
|
||||
|
11
apiGo/database/settings/Settings.go
Normal file
11
apiGo/database/settings/Settings.go
Normal file
@ -0,0 +1,11 @@
|
||||
package settings
|
||||
|
||||
var tvShowEnabled bool
|
||||
|
||||
func TVShowsEnabled() bool {
|
||||
return tvShowEnabled
|
||||
}
|
||||
|
||||
func SetTVShowEnabled(enabled bool) {
|
||||
tvShowEnabled = enabled
|
||||
}
|
@ -7,6 +7,7 @@ import (
|
||||
"net/http"
|
||||
"openmediacenter/apiGo/api"
|
||||
"openmediacenter/apiGo/database"
|
||||
settings2 "openmediacenter/apiGo/database/settings"
|
||||
"openmediacenter/apiGo/static"
|
||||
"openmediacenter/apiGo/videoparser"
|
||||
)
|
||||
@ -55,8 +56,12 @@ func handleCommandLineArguments() (*database.DatabaseConfig, bool, *string) {
|
||||
|
||||
pathPrefix := flag.String("ReindexPrefix", "/var/www/openmediacenter", "Prefix path for videos to reindex")
|
||||
|
||||
disableTVShowSupport := flag.Bool("DisableTVSupport", false, "Disable the TVShow support and pages")
|
||||
|
||||
flag.Parse()
|
||||
|
||||
settings2.SetTVShowEnabled(!*disableTVShowSupport)
|
||||
|
||||
return &database.DatabaseConfig{
|
||||
DBHost: *dbhostPtr,
|
||||
DBPort: *dbPortPtr,
|
||||
|
Reference in New Issue
Block a user