In some circumstances (not yet sure when this happens but it seems to have something to do with playing whole albums), next.Uri is an empty string here:
|
nextId := librespot.SpotifyIdFromUri(next.Uri) |
This leads to a crash:
|
func SpotifyIdFromUri(uri string) SpotifyId { |
|
id, err := SpotifyIdFromUriSafe(uri) |
|
if err != nil { |
|
panic(err) |
|
} |
The next object in this case looks like this:
&connectstate.ContextTrack{state:impl.MessageState{NoUnkeyedLiterals:pragma.NoUnkeyedLiterals{}, DoNotCompare:pragma.DoNotCompare{}, DoNotCopy:pragma.DoNotCopy{}, atomicMessageInfo:(*impl.MessageInfo)(nil)}, sizeCache:0, unknownFields:[]uint8(nil), Uri:"", Uid:"a1e0611f0a14df708f14", Gid:[]uint8{0x7, 0x7d, 0x48, 0x4f, 0x2c, 0x99, 0x4d, 0x24, 0x93, 0xcf, 0x57, 0x1, 0xfd, 0x71, 0xd7, 0x31}, Metadata:map[string]string{"context_uri":"spotify:album:0tiOfqFu4d3UJ2r1LsoG3Z", "entity_uri":"spotify:album:0tiOfqFu4d3UJ2r1LsoG3Z"}}
If you look into it, there's an album ID ("entity_uri":"spotify:album:0tiOfqFu4d3UJ2r1LsoG3Z"), and something that looks like a track ID (Uid:"a1e0611f0a14df708f14"). So it looks like there's enough information to prefetch this track, but I'm not entirely sure how to implement it.
(Interestingly this only happens while prefetching, perhaps the code that pulls the track ID when actually playing a track takes care of this case? In which case it would make sense to generalize that code and use it in both places).
In some circumstances (not yet sure when this happens but it seems to have something to do with playing whole albums),
next.Uriis an empty string here:go-librespot/cmd/daemon/controls.go
Line 25 in b95e6ac
This leads to a crash:
go-librespot/ids.go
Lines 110 to 114 in b95e6ac
The
nextobject in this case looks like this:If you look into it, there's an album ID (
"entity_uri":"spotify:album:0tiOfqFu4d3UJ2r1LsoG3Z"), and something that looks like a track ID (Uid:"a1e0611f0a14df708f14"). So it looks like there's enough information to prefetch this track, but I'm not entirely sure how to implement it.(Interestingly this only happens while prefetching, perhaps the code that pulls the track ID when actually playing a track takes care of this case? In which case it would make sense to generalize that code and use it in both places).