diff options
author | Christian Pointner <equinox@helsinki.at> | 2015-12-22 03:18:46 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2015-12-22 03:18:46 (GMT) |
commit | 5363f23b19df89eaf7fc8d0c250ab9db9b2ab8b3 (patch) | |
tree | d9eef55fa12a87335e0b4ae7bac6bf1d2fbb2c82 /importer.go | |
parent | bcc3483ff7e719c4e429b22e045937fd19e34400 (diff) |
session based callbacks work now
Diffstat (limited to 'importer.go')
-rw-r--r-- | importer.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/importer.go b/importer.go index a245270..575adc9 100644 --- a/importer.go +++ b/importer.go @@ -44,7 +44,7 @@ var ( bool2str = map[bool]string{false: "0", true: "1"} ) -type ImportProgressCB func(step int, step_name string, progress float64, userdata interface{}) +type ImportProgressCB func(step int, step_name string, progress float64, userdata interface{}) bool type ImportContext struct { conf *Config @@ -508,7 +508,9 @@ func import_audio(ctx *ImportContext, res *ImportResult) (err error) { } if ctx.ProgressCallBack != nil { - ctx.ProgressCallBack(2, "importing", ulnow/ultotal, ctx.ProgressCallBackData) + if keep := ctx.ProgressCallBack(2, "importing", ulnow/ultotal, ctx.ProgressCallBackData); !keep { + ctx.ProgressCallBack = nil + } } return true }) @@ -630,7 +632,9 @@ func ImportFile(ctx *ImportContext) (res *ImportResult, err error) { rhl.Printf("importer: ImportFile called with: show-id: %d, pool-name: '%s', cart/cut: %d/%d", ctx.ShowId, ctx.GroupName, ctx.Cart, ctx.Cut) if ctx.ProgressCallBack != nil { - ctx.ProgressCallBack(2, "importing", 0.0, ctx.ProgressCallBackData) + if keep := ctx.ProgressCallBack(2, "importing", 0.0, ctx.ProgressCallBackData); !keep { + ctx.ProgressCallBack = nil + } } if ctx.Trusted { |