diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-13 01:19:19 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-13 01:19:19 (GMT) |
commit | 2a2d9d2a574da4e21414698e8b9ed1d273f237bc (patch) | |
tree | ef82afb2b4dcd2ee862ffc43f84f78c58ab4c98b /importer.go | |
parent | c1bff94567a3f1bbfe631795608a24fa44394e76 (diff) |
importer can now fetch group of cart
Diffstat (limited to 'importer.go')
-rw-r--r-- | importer.go | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/importer.go b/importer.go index 0fc5ecf..95f61f7 100644 --- a/importer.go +++ b/importer.go @@ -125,6 +125,21 @@ func (ctx *ImportContext) getPassword(cached bool) (err error) { return } +func (ctx *ImportContext) getGroupOfCart() (err error) { + req := getGroupOfCartRequest{} + req.cart = ctx.Cart + req.response = make(chan getGroupOfCartResult) + ctx.RdDb.getGroupOfCartChan <- req + + res := <-req.response + if res.err != nil { + err = res.err + return + } + ctx.GroupName = res.group + return +} + func (ctx *ImportContext) getShowInfo() (err error) { req := getShowInfoRequest{} req.showid = ctx.ShowId @@ -434,7 +449,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { return } else if ctx.GroupName != "" { res.ResponseCode = 500 - res.ErrorString = "Importing to music pools using the group name is not yet implemented" + res.ErrorString = "Importing to music pools is not yet implemented" // TODO: fetch info from dropboxes (import-params) // - add_cart(ctx, res) [200 -> OK] // - add_cut(ctx, res) [200 -> OK] @@ -443,7 +458,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { res.ResponseCode = 500 res.ErrorString = "Importing to a Cart which might not exist is not yet implemented" // TODO: (everything except Cut, GroupName and ShowId must be in context) - // - ctx.GetGroupOfCart(ctx.Cart) + // - ctx.getGroupOfCart(ctx.Cart) // - remove_cart(ctx, res) [200 || 404 -> OK] // - add_cart(ctx, res) [200 -> OK] // - add_cut(ctx, res) [200 -> OK] @@ -456,7 +471,7 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { res.Cut = ctx.Cut } else { res.ResponseCode = http.StatusBadRequest - res.ErrorString = "The request doesn't contain enough Information to be processed" + res.ErrorString = "The request doesn't contain enough information to be processed" } rhdl.Printf("ImportResult: %+v\n", res) |