summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimport/importer.go
diff options
context:
space:
mode:
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r--src/helsinki.at/rhimport/importer.go11
1 files changed, 9 insertions, 2 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go
index df491d7..512daf6 100644
--- a/src/helsinki.at/rhimport/importer.go
+++ b/src/helsinki.at/rhimport/importer.go
@@ -502,10 +502,11 @@ func import_audio(ctx *ImportContext, res *ImportResult) (err error) {
easy.Setopt(curl.OPT_NOPROGRESS, false)
easy.Setopt(curl.OPT_PROGRESSFUNCTION, func(dltotal, dlnow, ultotal, ulnow float64, userdata interface{}) bool {
if ctx.Cancel != nil && len(ctx.Cancel) > 0 {
+ res.ResponseCode = http.StatusNoContent
+ res.ErrorString = "canceled"
return false
}
- ctx := userdata.(*ImportContext)
if ctx.ProgressCallBack != nil {
ctx.ProgressCallBack(2, "importing", ulnow/ultotal, ctx.ProgressCallBackData)
}
@@ -514,7 +515,13 @@ func import_audio(ctx *ImportContext, res *ImportResult) (err error) {
easy.Setopt(curl.OPT_PROGRESSDATA, ctx)
if err = easy.Perform(); err != nil {
- err = fmt.Errorf("importer: %s", err)
+ if res.ResponseCode == http.StatusNoContent {
+ res.Cart = ctx.Cart
+ res.Cut = ctx.Cut
+ err = nil
+ } else {
+ err = fmt.Errorf("importer: %s", err)
+ }
return
}