Skip to content

add: feedback tracking for individual track not part of playlist/artist/album #72

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/feedback.ts
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,8 @@ export function GetFeedbacksList(getState: () => SpotifyState): CompanionFeedbac

[FeedbackId.CurrentContext]: {
type: 'boolean',
name: 'Change button style if current album/artist/playlist id matches value',
description: 'If active album/artist/playlist matches value, change button color',
name: 'Change button style if current album/artist/playlist/track id matches value',
description: 'If active album/artist/playlist/track matches value, change button color',
options: [
{
type: 'textinput',
Expand Down
7 changes: 7 additions & 0 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,13 @@ class SpotifyInstance extends InstanceBase<DeviceConfig> implements SpotifyInsta
deviceInfo: null,
}

// If an individual track is playing then context is null from Spotify API
// If the current context is null, but a track is playing, then set the context to the track uri
// This allows feedbacks to be triggered when an track is playing
if (newState.currentContext === null && data.body.currently_playing_type === 'track' && data.body.item) {
newState.currentContext = data.body.item.uri.split(':')[2]
}

if (data.body.item) {
newState.trackInfo = {
durationMs: data.body.item.duration_ms,
Expand Down
Loading