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

Function saveWizard

src/data.go:621–719  ·  view source on GitHub ↗

Wizard (WebUI)

(request RequestStruct)

Source from the content-addressed store, hash-verified

619
620// Wizard (WebUI)
621func saveWizard(request RequestStruct) (nextStep int, err error) {
622
623 var wizard = jsonToMap(mapToJSON(request.Wizard))
624
625 for key, value := range wizard {
626
627 switch key {
628
629 case "tuner":
630 Settings.Tuner = int(value.(float64))
631 nextStep = 1
632
633 case "epgSource":
634 Settings.EpgSource = value.(string)
635 nextStep = 2
636
637 case "m3u", "xmltv":
638
639 var filesMap = make(map[string]interface{})
640 var data = make(map[string]interface{})
641 var indicator, dataID string
642
643 filesMap = make(map[string]interface{})
644
645 data["type"] = key
646 data["new"] = true
647
648 switch key {
649
650 case "m3u":
651 filesMap = Settings.Files.M3U
652 data["name"] = "M3U"
653 indicator = "M"
654
655 case "xmltv":
656 filesMap = Settings.Files.XMLTV
657 data["name"] = "XMLTV"
658 indicator = "X"
659
660 }
661
662 dataID = indicator + randomString(19)
663 data["file.source"] = value.(string)
664
665 filesMap[dataID] = data
666
667 switch key {
668 case "m3u":
669 Settings.Files.M3U = filesMap
670 nextStep = 3
671
672 err = getProviderData(key, dataID)
673
674 if err != nil {
675 ShowError(err, 000)
676 delete(filesMap, dataID)
677 return
678 }

Callers 1

WSFunction · 0.70

Calls 8

jsonToMapFunction · 0.85
getProviderDataFunction · 0.85
ShowErrorFunction · 0.85
buildDatabaseDVRFunction · 0.85
buildXEPGFunction · 0.85
mapToJSONFunction · 0.70
randomStringFunction · 0.70
saveSettingsFunction · 0.70

Tested by

no test coverage detected