summaryrefslogtreecommitdiff
path: root/src/helsinki.at/rhimportd/ctrlWebSimple.go
diff options
context:
space:
mode:
authorChristian Pointner <equinox@helsinki.at>2015-12-10 16:30:40 (GMT)
committerChristian Pointner <equinox@helsinki.at>2015-12-10 16:30:40 (GMT)
commitfa921c13ae7d2fb82ab5801244b6b1e9ef7db371 (patch)
tree9e0abeebd534f179fab16042cd8f5e867bbcb66d /src/helsinki.at/rhimportd/ctrlWebSimple.go
parentce68e63d07aa6efa926601298a472818ae6a37a6 (diff)
added support for progress callbacks
Diffstat (limited to 'src/helsinki.at/rhimportd/ctrlWebSimple.go')
-rw-r--r--src/helsinki.at/rhimportd/ctrlWebSimple.go5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/helsinki.at/rhimportd/ctrlWebSimple.go b/src/helsinki.at/rhimportd/ctrlWebSimple.go
index 7b7c70d..1d28818 100644
--- a/src/helsinki.at/rhimportd/ctrlWebSimple.go
+++ b/src/helsinki.at/rhimportd/ctrlWebSimple.go
@@ -67,6 +67,10 @@ func webSimpleResponse(w http.ResponseWriter) {
encoder.Encode(respdata)
}
+func webSimpleProgressCallback(step int, step_name string, progress float64, userdata interface{}) {
+ fmt.Printf("Step %d / %s: %3.2f%%\r", step, step_name, progress * 100)
+}
+
func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDb, trusted bool, r *http.Request) (ctx *rhimport.ImportContext, err error) {
decoder := json.NewDecoder(r.Body)
@@ -90,6 +94,7 @@ func webSimpleParseRequest(conf *rhimport.Config, rddb *rhimport.RdDb, trusted b
ctx.AutotrimLevel = reqdata.AutotrimLevel
ctx.UseMetaData = reqdata.UseMetaData
ctx.SourceUri = reqdata.SourceUri
+ ctx.ProgressCallBack = webSimpleProgressCallback
return
}