summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-14 14:48:37 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-14 14:48:37 (GMT)
commit97b905e99b95b6611d8d87bda90b56e47f2a5040 (patch)
tree0ec9f5c2b6c70b156e867ee770c31c42074a936c /src/helsinki.at/rhimportd
parent775a762b0c3d67d2ea19f288bec8c2ce857ec198 (diff)
fixed bug where some context values where not initialiized properly
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSimple.go22
1 files changed, 20 insertions, 2 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go
index 5be760c..41e4f81 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSimple.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go
@@ -48,6 +48,24 @@ type webSimpleRequestData struct {
SourceUri string `json:"SOURCE_URI"`
}
+func newWebSimpleRequestData(conf *rhimport.Config) *webSimpleRequestData {
+ rd := new(webSimpleRequestData)
+ rd.UserName = ""
+ rd.Password = ""
+ rd.ShowId = 0
+ rd.ClearShowCarts = false
+ rd.MusicPoolGroup = ""
+ rd.Cart = 0
+ rd.Cut = 0
+ rd.Channels = conf.ImportParamDefaults.Channels
+ rd.NormalizationLevel = conf.ImportParamDefaults.NormalizationLevel
+ rd.AutotrimLevel = conf.ImportParamDefaults.AutotrimLevel
+ rd.UseMetaData = conf.ImportParamDefaults.UseMetaData
+ rd.SourceUri = ""
+
+ return rd
+}
+
type webSimpleResponseData struct {
ResponseCode int `json:"REPONSE_CODE"`
ErrorString string `json:"ERROR_STRING"`
@@ -78,8 +96,8 @@ func webSimpleProgressCallback(step int, step_name string, progress float64, use
func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool, r *http.Request) (ctx *rhimport.ImportContext, err error) {
decoder := json.NewDecoder(r.Body)
- var reqdata webSimpleRequestData
- if jsonerr := decoder.Decode(&reqdata); jsonerr != nil {
+ reqdata := newWebSimpleRequestData(conf)
+ if jsonerr := decoder.Decode(reqdata); jsonerr != nil {
err = fmt.Errorf("Error parsing JSON response: %s", jsonerr)
return
}