Skip to content
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

cardMedia - Spotify Repeat Funktion #25

Open
Armilar opened this issue Feb 26, 2024 · 0 comments
Open

cardMedia - Spotify Repeat Funktion #25

Armilar opened this issue Feb 26, 2024 · 0 comments
Assignees
Labels
bug Something isn't working

Comments

@Armilar
Copy link
Collaborator

Armilar commented Feb 26, 2024

Die Repeat Funktion hat 3 Zustände im Spotiy-Premium Adapter

                icon: {
                    true: { // Repeat hat im Spotify drei Zustände (off, track, context)
                        value: {
                            type: 'triggered',
                            dp: 'spotify-premium.0.player.repeat',
                            read: `{
                                        switch (val) {
		                                    case 'off':
                                                return 'repeat-variant';
                                            case 'context'
                                                return 'repeat-variant';
			                                case 'track'
                                                return 'repeat-once';
                                            default:
                                                return 'alert-circle-outline';
                                        }
                                    }`,
                        },
                        color: {
                            type: 'triggered',
                            dp: 'spotify-premium.0.player.repeat',
                            read: `{
                                        switch (val) {
		                                    case 'off':
                                                return Color.HMIOff;
                                            case 'context'
                                                return Color.HMIOn;
			                                case 'track'
                                                return Color.HMIOn;
                                            default:
                                                return Color.Red;
                                        }
                                    }`,
                        },
                    },

Das NSPanelTs.ts ist hier einfach unterwegs und taktet einfach die Zustände von spotify-premium.0.player.repeat durch:

                                    switch (deviceAdapterRP) {
                                        case 'spotify-premium':
                                            if (Debug) log(getState(id + '.REPEAT').val);
                                            let stateSpotifyRepeat = getState(id + '.REPEAT').val;
                                            if (stateSpotifyRepeat == 'off') {
                                                setIfExists(id + '.REPEAT', 'context');
                                            } else if (stateSpotifyRepeat == 'context') {
                                                setIfExists(id + '.REPEAT', 'track');
                                            } else if (stateSpotifyRepeat == 'track') {
                                                setIfExists(id + '.REPEAT', 'off');
                                            }
@Armilar Armilar added the bug Something isn't working label Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants