Skip to content

fix: handle missing popularity field in track data#37

Merged
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
fanxing11:fix/popularity-keyerror
May 24, 2026
Merged

fix: handle missing popularity field in track data#37
ErikBjare merged 1 commit into
ActivityWatch:masterfrom
fanxing11:fix/popularity-keyerror

Conversation

@fanxing11

Copy link
Copy Markdown
Contributor

The Spotify API sometimes omits the popularity field from the track object, which causes a KeyError crash (see #36).

Switched to .get("popularity", -1) so it falls back gracefully instead of crashing the watcher.

Use .get() with default to avoid KeyError when the Spotify API
omits the 'popularity' field from the track object.

Fixes ActivityWatch#36
@ErikBjare ErikBjare merged commit cb38b7f into ActivityWatch:master May 24, 2026
1 check failed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants