Fix playlist metadata fields parsing #1019
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
On the
new-api
branch, running theplaylist_tracks
example failed for me on all playlists I tried. (e.g.,spotify:playlist:44PATzOl8NaSihxJQs02h6
)Logging several values revealed that some fields (
revision
,item_id
) were parsed intoSpotifyId
s, which failed, sinceSpotifyId
expects exactly 16 bytes, while those were of different lengths. Additionally, there were some optional fields (diff
,sync_result
), which weren't present in this case, and, as such, a default was used. This default included a[]
, which would then also be parsed as aSpotifyId
and failed.Apart from that, the timestamps included in the response were all in milliseconds and exceeded the accepted range in
OffsetDateTime::from_unix_timestamp()
.See playlist_proto.txt (or the binary version playlist_bin.txt) for the data for all this occurred with.
While the example works now, I'm not sure about some things:
diff
,sync_result
). Should those all be wrapped inOption
s or should theSpotifyId
just be changed to not fail on the default case ([]
)?Option<T>
s than the.as_ref().map(TryInto::try_into).transpose()?
?TryFrom<i64> for Date
implementation used anywhere else, where the value is not inmilliseconds
?Vec<u8>
fields?