override config entries with cli args

use getconfig instead of settings file
This commit is contained in:
2021-09-09 23:33:04 +02:00
parent 2706929bb4
commit aa49d601ab
7 changed files with 156 additions and 111 deletions

View File

@ -4,6 +4,7 @@ import (
"encoding/json"
"fmt"
"openmediacenter/apiGo/api/types"
"openmediacenter/apiGo/config"
"openmediacenter/apiGo/database"
"openmediacenter/apiGo/database/settings"
"openmediacenter/apiGo/videoparser"
@ -88,8 +89,8 @@ func getSettingsFromDB() {
MediacenterName: sett.MediacenterName,
VideoPath: serverVideoPath,
TVShowPath: serverTVShowPath,
TVShowEnabled: settings.TVShowsEnabled(),
FullDeleteEnabled: settings.VideosDeletable(),
TVShowEnabled: !config.GetConfig().Features.DisableTVSupport,
FullDeleteEnabled: config.GetConfig().Features.FullyDeletableVideos,
}
str, _ := json.Marshal(res)

View File

@ -2,13 +2,13 @@ package api
import (
"fmt"
"openmediacenter/apiGo/config"
"openmediacenter/apiGo/database"
"openmediacenter/apiGo/database/settings"
)
func AddTvshowHandlers() {
// do not add handlers if tvshows not enabled
if !settings.TVShowsEnabled() {
if config.GetConfig().Features.DisableTVSupport {
return
}

View File

@ -5,8 +5,8 @@ import (
"fmt"
"net/url"
"openmediacenter/apiGo/api/types"
"openmediacenter/apiGo/config"
"openmediacenter/apiGo/database"
"openmediacenter/apiGo/database/settings"
"os"
"strconv"
)
@ -448,7 +448,7 @@ func addToVideoHandlers() {
}
// only allow deletion of video if cli flag is set, independent of passed api arg
if settings.VideosDeletable() && args.FullyDelete {
if config.GetConfig().Features.FullyDeletableVideos && args.FullyDelete {
// get physical path of video to delete
query = fmt.Sprintf("SELECT movie_url FROM videos WHERE movie_id=%d", args.MovieId)
var vidpath string