1 Star 0 Fork 0

robert.X / witnessmenow

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

spotify-api-arduino

Travis CI status License Release stable
Arduino library for integrating with a subset of the Spotify Web-API (Does not play music)

Work in progress library - expect changes!

Supported Boards:

ESP32

Working well

ESP8266

Working well

Other boards - Arduino Wifi Nina (Nano IOT etc)

Should in theory work, but I have no tested it on them and will not be able to provide support for them.

Help support what I do!

I have put a lot of effort into creating Arduino libraries that I hope people can make use of. If you enjoy my work, please consider becoming a Github sponsor!

Library Features:

The Library supports the following features:

  • Get Authentication Tokens
  • Getting your currently playing track
  • Player Controls:
    • Next
    • Previous
    • Seek
    • Play (basic version, basically resumes a paused track)
    • Play Advanced (play given song, album, artist)
    • Pause
    • Set Volume (doesn't seem to work on my phone, works on desktop though)
    • Set Repeat Modes
    • Toggle Shuffle
  • Get Devices
  • Search Spotify Library

What needs to be added:

  • Better instructions for how to set up your refresh token.
  • Example where refresh token and full operation are handled in same sketch.

Setup Instructions

Spotify Account

  • Sign into the Spotify Developer page
  • Create a new application. (name it whatever you want)
  • You will need to use the "client ID" and "client secret" from this page in your sketches
  • You will also need to add a callback URI for authentication process by clicking "Edit Settings", what URI to add will be mentioned in further instructions

Getting Your Refresh Token

Spotify's Authentication flow requires a webserver to complete, but it's only needed once to get your refresh token. Your refresh token can then be used in all future sketches to authenticate.

Because the webserver is only needed once, I decided to seperate the logic for getting the Refresh token to it's own example.

Follow the instructions in the getRefreshToken example to get your token.

Note: Once you have a refresh token, you can use it on either platform in your sketches, it is not tied to any particular device.

Running

Take one of the included examples and update it with your WiFi creds, Client ID, Client Secret and the refresh token you just generated.

Scopes

By default the getRefreshToken examples will include the required scopes, but if you want change them the following info might be useful.

put a %20 between the ones you need.

Feature Required Scope
Current Playing Song Info user-read-playback-state
Player Controls user-modify-playback-state

Installation

Download zip from Github and install to the Arduino IDE using that.

Dependancies

  • V6 of Arduino JSON - can be installed through the Arduino Library manager.

Compile flag configuration

There are some flags that you can set in the SpotifyArduino.h that can help with debugging


#define SPOTIFY_DEBUG 1
// Enables extra debug messages on the serial.
// Will be disabled by default when library is released.
// NOTE: Do not use this option on live-streams, it will reveal your private tokens!

#define SPOTIFY_SERIAL_OUTPUT 1
// Comment out if you want to disable any serial output from this library
// (also comment out DEBUG and PRINT_JSON_PARSE)

//#define SPOTIFY_PRINT_JSON_PARSE 1
// Prints the JSON received to serial (only use for debugging as it will be slow)
// Requires the installation of ArduinoStreamUtils (https://github.com/bblanchon/ArduinoStreamUtils)
MIT License Copyright (c) 2021 Brian Lough Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
C++ 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/robert_Philbaz/witnessmenow.git
git@gitee.com:robert_Philbaz/witnessmenow.git
robert_Philbaz
witnessmenow
witnessmenow
main

搜索帮助