summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd
diff options
context:
space:
mode:
authorChristian Pointner <equinox@spreadspace.org>2015-12-14 04:02:37 (GMT)
committerChristian Pointner <equinox@spreadspace.org>2015-12-14 04:02:37 (GMT)
commit775a762b0c3d67d2ea19f288bec8c2ce857ec198 (patch)
treef6bbd0ad61db7b6b005b4aa151f6ea615b365486 /src/helsinki.at/rhimportd
parent54ee84d1a3287a837a9c2df92ae1cf3223c06377 (diff)
added more sophisticated import options - still needs testing
Diffstat (limited to 'src/helsinki.at/rhimportd')
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSimple.go17
1 files changed, 15 insertions, 2 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go
index 40fe808..5be760c 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSimple.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go
@@ -36,6 +36,9 @@ import (
type webSimpleRequestData struct {
UserName string `json:"LOGIN_NAME"`
Password string `json:"PASSWORD"`
+ ShowId uint `json:"SHOW_ID"`
+ ClearShowCarts bool `json:"CLEAR_SHOW_CARTS"`
+ MusicPoolGroup string `json:"MUSIC_POOL_GROUP"`
Cart uint `json:"CART_NUMBER"`
Cut uint `json:"CUT_NUMBER"`
Channels uint `json:"CHANNELS"`
@@ -48,13 +51,15 @@ type webSimpleRequestData struct {
type webSimpleResponseData struct {
ResponseCode int `json:"REPONSE_CODE"`
ErrorString string `json:"ERROR_STRING"`
+ Cart uint `json:"CART_NUMBER"`
+ Cut uint `json:"CUT_NUMBER"`
}
func webSimpleErrorResponse(w http.ResponseWriter, code int, error_str string) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
encoder := json.NewEncoder(w)
- respdata := webSimpleResponseData{code, error_str}
+ respdata := webSimpleResponseData{code, error_str, 0, 0}
encoder.Encode(respdata)
}
@@ -62,7 +67,7 @@ func webSimpleResponse(w http.ResponseWriter, result *rhimport.ImportResult) {
w.Header().Set("Content-Type", "application/json")
w.WriteHeader(http.StatusInternalServerError)
encoder := json.NewEncoder(w)
- respdata := webSimpleResponseData{result.ResponseCode, result.ErrorString}
+ respdata := webSimpleResponseData{result.ResponseCode, result.ErrorString, result.Cart, result.Cut}
encoder.Encode(respdata)
}
@@ -86,6 +91,9 @@ func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDb, trusted b
ctx = rhimport.NewImportContext(conf, rddb, username)
ctx.Password = reqdata.Password
ctx.Trusted = trusted
+ ctx.ShowId = reqdata.ShowId
+ ctx.ClearShowCarts = reqdata.ClearShowCarts
+ ctx.GroupName = reqdata.MusicPoolGroup
ctx.Cart = reqdata.Cart
ctx.Cut = reqdata.Cut
ctx.Channels = reqdata.Channels
@@ -122,6 +130,11 @@ func webSimpleHandler(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool,
webSimpleErrorResponse(w, http.StatusInternalServerError, err.Error())
return
}
+ if result.ResponseCode == http.StatusOK {
+ rhl.Println("ImportFile succesfully imported", ctx.SourceFile)
+ } else {
+ rhl.Println("ImportFile import of", ctx.SourceFile, "was unsuccesful")
+ }
webSimpleResponse(w, result)
return