MCPcopy Index your code
hub / github.com/Threadfin/Threadfin / updateServerSettings

Function updateServerSettings

src/data.go:28–266  ·  view source on GitHub ↗

Einstellungen ändern (WebUI)

(request RequestStruct)

Source from the content-addressed store, hash-verified

26
27// Einstellungen ändern (WebUI)
28func updateServerSettings(request RequestStruct) (settings SettingsStruct, err error) {
29
30 var oldSettings = jsonToMap(mapToJSON(Settings))
31 var newSettings = jsonToMap(mapToJSON(request.Settings))
32 var reloadData = false
33 var cacheImages = false
34 var createXEPGFiles = false
35 var debug string
36
37 // -vvv [URL] --sout '#transcode{vcodec=mp4v, acodec=mpga} :standard{access=http, mux=ogg}'
38
39 for key, value := range newSettings {
40
41 if _, ok := oldSettings[key]; ok {
42
43 switch key {
44
45 case "tuner":
46 showWarning(2105)
47
48 case "epgSource":
49 reloadData = true
50
51 case "update":
52 // Leerzeichen aus den Werten entfernen und Formatierung der Uhrzeit überprüfen (0000 - 2359)
53 var newUpdateTimes = make([]string, 0)
54
55 for _, v := range value.([]interface{}) {
56
57 v = strings.Replace(v.(string), " ", "", -1)
58
59 _, err := time.Parse("1504", v.(string))
60 if err != nil {
61 ShowError(err, 1012)
62 return Settings, err
63 }
64
65 newUpdateTimes = append(newUpdateTimes, v.(string))
66
67 }
68
69 if len(newUpdateTimes) == 0 {
70 //newUpdateTimes = append(newUpdateTimes, "0000")
71 }
72
73 value = newUpdateTimes
74
75 case "cache.images":
76 cacheImages = true
77
78 case "xepg.replace.missing.images":
79 case "xepg.replace.channel.title":
80 createXEPGFiles = true
81
82 case "backup.path":
83 value = strings.TrimRight(value.(string), string(os.PathSeparator)) + string(os.PathSeparator)
84 err = checkFolder(value.(string))
85 if err == nil {

Callers 1

WSFunction · 0.85

Calls 15

NewFunction · 0.92
jsonToMapFunction · 0.85
showWarningFunction · 0.85
ShowErrorFunction · 0.85
checkFolderFunction · 0.85
checkFilePermissionFunction · 0.85
checkFileFunction · 0.85
showDebugFunction · 0.85
getErrMsgFunction · 0.85
buildDatabaseDVRFunction · 0.85
buildXEPGFunction · 0.85
createXMLTVFileFunction · 0.85

Tested by

no test coverage detected