Show scan rate in web GUI

This commit is contained in:
Jakob Borg
2015-11-17 21:08:36 +01:00
parent 37f866b47f
commit a8a2192cf9
7 changed files with 80 additions and 16 deletions

View File

@@ -126,11 +126,12 @@ func (s *verboseSvc) formatEvent(ev events.Event) string {
folder := data["folder"].(string)
current := data["current"].(int64)
total := data["total"].(int64)
rate := data["rate"].(float64) / 1024 / 1024
var pct int64
if total > 0 {
pct = 100 * current / total
}
return fmt.Sprintf("Scanning folder %q, %d%% done", folder, pct)
return fmt.Sprintf("Scanning folder %q, %d%% done (%.01f MB/s)", folder, pct, rate)
case events.DevicePaused:
data := ev.Data.(map[string]string)