Ignore parsefloat errors
parent
bec3683b44
commit
1d2374a398
12
events.go
12
events.go
|
@ -374,16 +374,8 @@ func (app *App) songPosition(payload ...interface{}) {
|
||||||
msg := make(map[string]interface{})
|
msg := make(map[string]interface{})
|
||||||
out := make(map[string]interface{})
|
out := make(map[string]interface{})
|
||||||
|
|
||||||
slen, err := strconv.ParseFloat(status["duration"], 64)
|
slen, _ := strconv.ParseFloat(status["duration"], 64)
|
||||||
if err != nil {
|
spos, _ := strconv.ParseFloat(status["elapsed"], 64)
|
||||||
log.Println(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
spos, err := strconv.ParseFloat(status["elapsed"], 64)
|
|
||||||
if err != nil {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
msg["event"] = "song_position"
|
msg["event"] = "song_position"
|
||||||
out["len"] = time.Duration(slen * float64(time.Second)).Milliseconds()
|
out["len"] = time.Duration(slen * float64(time.Second)).Milliseconds()
|
||||||
|
|
Loading…
Reference in New Issue