mirror of
https://github.com/ramsayleung/rspotify.git
synced 2026-04-26 07:55:55 +03:00
[PR #251] [MERGED] Allow negative values in duration_ms #342
Labels
No labels
Stale
bug
discussion
enhancement
good first issue
good first issue
help wanted
pull-request
question
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/rspotify#342
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/ramsayleung/rspotify/pull/251
Author: @flip1995
Created: 9/15/2021
Status: ✅ Merged
Merged: 9/15/2021
Merged by: @ramsayleung
Base:
master← Head:neg_resume_position_ms📝 Commits (1)
d654f82Allow negative values in duration_ms📊 Changes
2 files changed (+19 additions, -0 deletions)
View changed files
📝
rspotify-model/src/custom_serde.rs(+6 -0)📝
tests/test_models.rs(+13 -0)📄 Description
Description
This patch adds a parser for
i64values toduration_ms, so that it no longer fails for negative numbers. This works, according to the serde documentation:Motivation and Context
The spotify API doesn't make any guarantees, if the returned integers are signed or unsigned. It turns out, that for the
resume_position_msvalue in theResumePointObjectused forEpisodes can be negative. I've only seen the value-1000, but don't know when this occurs or if other values are possible.I noticed this using the

spotify-tuicrate, that uses this crate as a dependency. See screenshot below:Dependencies
None
Type of change
Please delete options that are not relevant.
How Has This Been Tested?
By adding a unit test to the
test_modelsfile. The previous behavior is unchanged (according to existing tests)🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.