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 | e40235206363f09a43723fd7af10ef66bcfa08a3 (patch) | |
tree | e00bd8861c3e460eaf64f98ade15d03006189c61 /src/helsinki.at/rhimport/importer.go | |
parent | c0463be82447f269d9947d16a40881dbbe600827 (diff) |
session based callbacks work now
Diffstat (limited to 'src/helsinki.at/rhimport/importer.go')
-rw-r--r-- | src/helsinki.at/rhimport/importer.go | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/helsinki.at/rhimport/importer.go b/src/helsinki.at/rhimport/importer.go index a245270..575adc9 100644 --- a/src/helsinki.at/rhimport/importer.go +++ b/src/helsinki.at/rhimport/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 { |