Panic
`panic: interface conversion: interface {} is nil, not string
goroutine 1 [running]: main.genericCmd(0x1b, 0x0, 0x11d82360, 0xb, 0x11d84348, 0x1, 0x1) /home/pi/go/src/github.com/CBiX/gotubecast/main.go:291 +0x40a0 main.decodeBindStream(0x74c6bd10, 0x11dfa4d0, 0x11dfa4d0, 0x74c6bd10) /home/pi/go/src/github.com/CBiX/gotubecast/main.go:233 +0x104 main.main() /home/pi/go/src/github.com/CBiX/gotubecast/main.go:191 +0x11d4`
Hi, can you post the lines above as well, so I can see which cmd triggered your error? Thanks.
Quickfix would be changing line 291
currentTime := data["currentTime"].(string)
to
currentTime := 0
if data["currentTime"] != nil {
currentTime = data["currentTime"].(string)
}
Anyway I'll integrate more data checks soon, thanks for reporting this one :)
Will try that and revert.
Also I am noticing delay in music playback, after I select the video and the video starts playing on the Raspberry Pi. The delay is in the range 15 - 20 seconds. Is it normal?
Yea the script uses youtube-dl, which can take around 15 secs to start and fetch the video stream URL. Because there is no open API for obtaining the stream link from a video ID, we have to rely on youtube-dl here for now.
Hi, can you post the lines above as well, so I can see which cmd triggered your error? Thanks.
Quickfix would be changing line 291
currentTime := data["currentTime"].(string)tocurrentTime := 0 if data["currentTime"] != nil { currentTime = data["currentTime"].(string) }Anyway I'll integrate more data checks soon, thanks for reporting this one :)
after Quickfix, the following build errors occurs: root@raspberrypi:~/gotubecast# GOARCH=arm go build
_/root/gotubecast
./main.go:293: cannot use data["currentTime"].(string) (type string) as type int in assignment ./main.go:306: cannot convert "s" to type int ./main.go:306: invalid operation: currentTime + "s" (mismatched types int and string) ./main.go:321: cannot use currentTime (type int) as type string in map value ./main.go:329: cannot use currentTime (type int) as type string in map value