override config entries with cli args
use getconfig instead of settings file
This commit is contained in:
		@@ -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)
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -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
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user