Spotify controller for MagicMirror. Multiples accounts supported!
- Showing Current playback on any devices
- Playing Controllable by Notification & touch (Play, pause, next, previous, volume)
- Spotify Controllable by Notification (change device, search and play)
- Multiple accounts supported
- Fixed: Using old configuration error.
-
Added :
MULTIPLE ACCOUNTS
-
How to update from older version
cd ~/MagicMirror/modules/MMM-Spotify
git pull
cd ~/MagicMirror/modules
git clone https://github.com/eouia/MMM-Spotify
cd MMM-Spotify
npm install
- You should be a premium member of Spotify
- Go to https://developer.spotify.com
- Navigate to DASHBOARD > Create an app (fill information as your thought)
- Setup the app created, (EDIT SETTINGS)
- Redirect URIs. :
http://localhost:8888/callback
- That's all you need. Just save it.
- Redirect URIs. :
- Now copy your Client ID and Client Secret to any memo
cd ~/MagicMirror/modules/MMM-Spotify
cp spotify.config.json.example spotify.config.json
nano spotify.config.json
Or any editor as your wish be ok. Open the spotify.config.json
then modify it. You can create a configuration object for each account you need to use. You need to just fill CLIENT_ID
and CLIENT_SECRET
for each of them. Then, save it.
[
{
"USERNAME": "USERNAME",
"CLIENT_ID" : "YOUR_CLIENT_ID",
"CLIENT_SECRET" : "YOUR_CLIENT_SECRET",
"AUTH_DOMAIN" : "http://localhost",
"AUTH_PATH" : "/callback",
"AUTH_PORT" : "8888",
"SCOPE" : "user-read-private playlist-read-private streaming user-read-playback-state user-modify-playback-state",
"TOKEN" : "./token.json"
}
]
cd ~/MagicMirror/modules/MMM-Spotify
node first_auth.js
Then, Allowance dialog popup will be opened. You MUST LOG IN IN SAME ORDER YOU PUT YOUR USERS IN CONFIGURATION FILE. Log in(if it is needed) and allow it.
That's all. token.json
will be created, if success.
cd ~/MagicMirror/modules/MMM-Spotify
npm install open
{
module: "MMM-Spotify",
position: "bottom_left",
config: {
}
}
{
module: "MMM-Spotify",
position: "bottom_left",
config: {
style: "default", // "default" or "mini" available
control: "default", //"default", "hidden" available
updateInterval: 1000,
onStart: null, // disable onStart feature with `null`
allowDevices: [], //If you want to limit devices to display info, use this.
// allowDevices: ["RASPOTIFY", "My iPhoneX", "My Home speaker"],
}
}
You can control Spotify on start of MagicMirror (By example; Autoplay specific playlist when MM starts)
onStart: {
deviceName: "RASPOTIFY", //if null, current(last) activated device will be.
spotifyUri: "spotify:track:3ENXjRhFPkH8YSH3qBXTfQ"
//when search is set, sportifyUri will be ignored.
search: {
type: "playlist", // `artist`, track`, `album`, `playlist` and its combination(`artist,playlist,album`) be available
keyword: "death metal",
random:true,
}
}
When search
field exists, spotifyUri
will be ignored.
SPOTIFY_SEARCH
: search items with query and play it.type
,query
,random
be payloads
this.sendNotification("SPOTIFY_SEARCH", {type:"artist,playlist", query:"michael+jackson", random:false})
SPOTIFY_PLAY
: playing specific SpotifyUri. There could be two types of uri -context_uri
anduris
.context_uri:String
: Spotify URI of the context to play. Valid contexts are albums, artists, playlists.uris:[]
: A JSON array of the Spotify track URIs to play
this.sendNotification("SPOTIFY_PLAY", {"context_uri": "spotify:album:1Je1IMUlBXcx1Fz0WE7oPT"})
//OR
this.sendNotification("SPOTIFY_PLAY", {
"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh", "spotify:track:1301WleyT98MSxVHPZCA6M"]
})
The SPOTIFY_PLAY notification can also be used as resume
feature of stopped/paused player, when used without payloads
SPOTIFY_PAUSE
: pausing current playback.
this.sendNotification("SPOTIFY_PAUSE")
SPOTIFY_TOGGLE
: toggling for playing/pausing
this.sendNotification("SPOTIFY_TOGGLE")
SPOTIFY_NEXT
: next track of current playback.
this.sendNotification("SPOTIFY_NEXT")
SPOTIFY_PREVIOUS
: previous track of current playback.
this.sendNotification("SPOTIFY_PREVIOUS")
SPOTIFY_VOLUME
: setting volume of current playback. payload will be volume (0 - 100)
this.sendNotification("SPOTIFY_VOLUME", 50)
SPOTIFY_TRANSFER
: change device of playing with device name (e.g: RASPOTIFY)
this.sendNotification("SPOTIFY_TRANSFER", "RASPOTIFY")
SPOTIFY_SHUFFLE
: toggle shuffle mode.
this.sendNotification("SPOTIFY_SHUFFLE")
SPOTIFY_REPEAT
: change repeat mode. (off
->track
->context
)
this.sendNotification("SPOTIFY_REPEAT")
See the wiki
- Added :
SPOTIFY_TOGGLE
notification for toggling Play/Pause
- Added : CSS variable for easy adjusting size. (Adjust only --sp-width to resize)
- Added : Hiding module when current playback device is inactivated. (More test might be needed, but...)
- Added: touch(click) interface
- Device Limitation : Now you can allow or limit devices to display its playing on MM.
- Some CSS structure is changed.
- Now this module can emit
SPOTIFY_*
notifications for other module.
Special thanks to @ejay-ibm so much for taking the time to cowork to make this module.