summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd
diff options
context:
space:
mode:
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
}