summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/rhimportd/ctrlTelnet.go2
-rw-r--r--src/rhimportd/ctrlWebSocket.go10
2 files changed, 7 insertions, 5 deletions
diff --git a/src/rhimportd/ctrlTelnet.go b/src/rhimportd/ctrlTelnet.go
index 83bb989..8ce4e83 100644
--- a/src/rhimportd/ctrlTelnet.go
+++ b/src/rhimportd/ctrlTelnet.go
@@ -264,7 +264,7 @@ func telnetShow(c *telgo.Client, args []string, conf *rhimport.Config, db *rddb.
return false
}
-func telnetProgressCallback(step int, stepName string, current, total float64, cart, cut uint, userdata interface{}) bool {
+func telnetProgressCallback(step int, stepName string, current, total float64, title string, cart, cut uint, userdata interface{}) bool {
c := userdata.(*telgo.Client)
if cart > 0 {
c.Say("%s: %3.2f%% (Cart/Cut: %d/%d)\r", stepName, (current/total)*100, cart, cut)
diff --git a/src/rhimportd/ctrlWebSocket.go b/src/rhimportd/ctrlWebSocket.go
index d522546..b55e634 100644
--- a/src/rhimportd/ctrlWebSocket.go
+++ b/src/rhimportd/ctrlWebSocket.go
@@ -99,6 +99,7 @@ type webSocketResponseProgressData struct {
Current float64 `json:"CURRENT"`
Total float64 `json:"TOTAL"`
Progress float64 `json:"PROGRESS"`
+ Title string `json:"TITLE"`
Cart uint `json:"CART_NUMBER"`
Cut uint `json:"CUT_NUMBER"`
}
@@ -142,7 +143,7 @@ func sendWebSocketListResponse(ws *websocket.Conn, sessions map[string]string) {
sendWebSocketResponse(ws, rd)
}
-func sendWebSocketProgressResponse(ws *websocket.Conn, id, refid string, step int, stepName string, current, total float64, cart, cut uint) {
+func sendWebSocketProgressResponse(ws *websocket.Conn, id, refid string, step int, stepName string, current, total float64, title string, cart, cut uint) {
progress := current / total
if math.IsNaN(progress) || math.IsInf(progress, 0) {
progress = 0.0
@@ -159,6 +160,7 @@ func sendWebSocketProgressResponse(ws *websocket.Conn, id, refid string, step in
rd.Current = current
rd.Total = total
rd.Progress = progress * 100
+ rd.Title = title
rd.Cart = cart
rd.Cut = cut
sendWebSocketResponse(ws, rd)
@@ -191,7 +193,7 @@ func newWebSocketSession() *webSocketSession {
return session
}
-func webSocketProgress(step int, stepName string, current, total float64, cart, cut uint, userdata interface{}) bool {
+func webSocketProgress(step int, stepName string, current, total float64, title string, cart, cut uint, userdata interface{}) bool {
if math.IsNaN(current) || math.IsInf(current, 0) {
current = 0.0
}
@@ -200,7 +202,7 @@ func webSocketProgress(step int, stepName string, current, total float64, cart,
}
c := userdata.(chan<- rhimport.ProgressData)
select {
- case c <- rhimport.ProgressData{Step: step, StepName: stepName, Current: current, Total: total, Cart: cart, Cut: cut}:
+ case c <- rhimport.ProgressData{Step: step, StepName: stepName, Current: current, Total: total, Title: title, Cart: cart, Cut: cut}:
default:
}
return true
@@ -315,7 +317,7 @@ func webSocketSessionHandler(reqchan <-chan webSocketRequestData, binchan <-chan
sendWebSocketErrorResponse(ws, http.StatusBadRequest, fmt.Sprintf("unknown command '%s'", reqdata.Command))
}
case p := <-session.progresschan:
- sendWebSocketProgressResponse(ws, session.id, session.refId, p.Step, p.StepName, p.Current, p.Total, p.Cart, p.Cut)
+ sendWebSocketProgressResponse(ws, session.id, session.refId, p.Step, p.StepName, p.Current, p.Total, p.Title, p.Cart, p.Cut)
case d := <-session.donechan:
sendWebSocketDoneResponse(ws, d.ResponseCode, d.ErrorString, session.id, session.refId, d.Cart, d.Cut)
rhdl.Println("WebSocket Client", ws.RemoteAddr(), "done sent: sending close message.")