mirror of
https://github.com/sascha-hemi/SpotifyEsp32.git
synced 2026-03-21 06:05:52 +01:00
Added partitions.csv to the project, which sets
the flash size from 1MB to 1.5MB
This commit is contained in:
@@ -114,9 +114,9 @@ To print the response you can use the ```print_response(response_obj)``` functio
|
||||
```
|
||||
- You can also include the namespace: ```using namespace Spotify_types;```. These are some types used in the library eg. TYPES, SIZES of uris/ids </br>
|
||||
## Trouble Shooting
|
||||
- If you have any problems with the library you can use the debug mode to print out the data to the serial monitor. I recommend not setting the baud rate lower than 115200 as the data printed can be quite large which can lead to crash if the Serial communication is too slow </br>
|
||||
- If you have any problems with the library you can use the debug mode to print out the data to the serial monitor. I recommend not setting the baud rate lower than 115200 as the data printed can be quite large which can lead to crash if the Serial communication is too slow. </br>
|
||||
- If you have any problems with the library you can also use the [Spotify Web API Console](https://developer.spotify.com/console/) to test the endpoints. </br>
|
||||
- If there are still issues you can open an issue on this repository. </br>
|
||||
### Working Devices
|
||||
## Working Devices
|
||||
- ESP32 WROOM</br>
|
||||
- Should also work on ESP2866 and other ESP32 models(Untested).</br>
|
||||
|
||||
12
Spotify_Esp32.code-workspace
Normal file
12
Spotify_Esp32.code-workspace
Normal file
@@ -0,0 +1,12 @@
|
||||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
},
|
||||
{
|
||||
"name": "Spotify_v3",
|
||||
"path": "Spotify_v3"
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
||||
7
Spotify_v3/partitions.csv
Normal file
7
Spotify_v3/partitions.csv
Normal file
@@ -0,0 +1,7 @@
|
||||
# Name, Type, SubType, Offset, Size, Flags
|
||||
nvs, data, nvs, 0x9000, 0x5000,
|
||||
otadata, data, ota, 0xe000, 0x2000,
|
||||
app0, app, ota_0, 0x10000, 0x180000,
|
||||
app1, app, ota_1, 0x190000,0x180000,
|
||||
eeprom, data, 0x99, 0x310000,0x1000,
|
||||
spiffs, data, spiffs, 0x311000,0xEF000,
|
||||
|
@@ -12,10 +12,11 @@
|
||||
platform = espressif32
|
||||
board = esp32doit-devkit-v1
|
||||
framework = arduino
|
||||
board_build.partitions = partitions.csv
|
||||
lib_deps =
|
||||
plageoj/UrlEncode@^1.0.1
|
||||
bblanchon/ArduinoJson@^7.0.3
|
||||
esphome/AsyncTCP-esphome@^2.1.2
|
||||
monitor_filters = esp32_exception_decoder
|
||||
monitor_speed = 115200
|
||||
build_flags = -w
|
||||
build_flags = -Og
|
||||
@@ -173,7 +173,7 @@ response Spotify::RestApi(char* rest_url, char* type, int payload_size, char* pa
|
||||
if(payload_size>0){
|
||||
http.addHeader("content-Length", String(payload_size));
|
||||
}
|
||||
int http_code;
|
||||
int http_code = -1;
|
||||
if(strcmp(type, "GET") == 0){
|
||||
http_code = http.GET();
|
||||
}
|
||||
@@ -819,36 +819,37 @@ response Spotify::create_playlist(char* user_id, char* name, bool is_public, boo
|
||||
|
||||
return RestApiPost(url, payload_size, payload);
|
||||
}
|
||||
response Spotify::get_featured_playlists( int limit, int offset,char* timestamp,char* country, char* locale) {
|
||||
char url[200];
|
||||
if(timestamp != nullptr){
|
||||
if((country == nullptr)&&(locale == nullptr)){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?timestamp=%s&limit=%d&offset=%d", timestamp, limit, offset);
|
||||
response Spotify::get_featured_playlists(int limit, int offset, char* timestamp, char* country, char* locale) {
|
||||
char url[200];
|
||||
if (timestamp) {
|
||||
if (!country && !locale) {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?timestamp=%s&limit=%d&offset=%d", timestamp, limit, offset);
|
||||
}
|
||||
else if (!country && locale) {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?locale=%s×tamp=%s&limit=%d&offset=%d", locale, timestamp, limit, offset);
|
||||
}
|
||||
else if (country && !locale) {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s×tamp=%s&limit=%d&offset=%d", country, timestamp, limit, offset);
|
||||
}
|
||||
else {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s&locale=%s×tamp=%s&limit=%d&offset=%d", country, locale, timestamp, limit, offset);
|
||||
}
|
||||
}
|
||||
else if((country == nullptr)&&(locale != nullptr)){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?locale=%s×tamp=%s&limit=%d&offset=%d", locale, timestamp, limit, offset);
|
||||
else {
|
||||
if (!country && !locale) {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?limit=%d&offset=%d", limit, offset);
|
||||
}
|
||||
else if (!country && locale) {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?locale=%s&limit=%d&offset=%d", locale, limit, offset);
|
||||
}
|
||||
else if (country && !locale) {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s&limit=%d&offset=%d", country, limit, offset);
|
||||
}
|
||||
else {
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s&locale=%s&limit=%d&offset=%d", country, locale, limit, offset);
|
||||
}
|
||||
}
|
||||
else if((country != nullptr)&&(locale == nullptr)){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s×tamp=%s&limit=%d&offset=%d", country, timestamp, limit, offset);
|
||||
}
|
||||
else{
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s&locale=%s×tamp=%s&limit=%d&offset=%d", country, locale, timestamp, limit, offset);
|
||||
}
|
||||
}else{
|
||||
if((country == nullptr)&&(locale == nullptr)){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?limit=%d&offset=%d", limit, offset);
|
||||
}
|
||||
else if((country == nullptr)&&(locale != nullptr)){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?locale=%s&limit=%d&offset=%d", locale, limit, offset);
|
||||
}
|
||||
else if((country != nullptr)&&(locale == nullptr)){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s&limit=%d&offset=%d", country, limit, offset);
|
||||
}
|
||||
else{
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/browse/featured-playlists?country=%s&locale=%s&limit=%d&offset=%d", country, locale, limit, offset);
|
||||
}
|
||||
}
|
||||
return RestApiGet(url);
|
||||
return RestApiGet(url);
|
||||
}
|
||||
response Spotify::get_category_playlists(char* category_id, int limit, int offset, char* country) {
|
||||
char url[200];
|
||||
@@ -880,7 +881,7 @@ response Spotify::add_custom_playlist_cover_image(char* playlist_id, char* data)
|
||||
response Spotify::search(char* q, int type_size, char** type, int limit, int offset, char* market){
|
||||
char url[_max_char_size];
|
||||
char arr[_max_char_size];
|
||||
if(market != nullptr){
|
||||
if(market){
|
||||
if(type_size == 0){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/search?q=%s&limit=%d&offset=%d&market=%s", q, limit, offset, market);
|
||||
}
|
||||
@@ -891,10 +892,10 @@ response Spotify::search(char* q, int type_size, char** type, int limit, int off
|
||||
}
|
||||
else{
|
||||
if(type_size == 0){
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/search?q=%s&limit=%d&offset=%d&market=%s", q, limit, offset, market);
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/search?q=%s&limit=%d&offset=%d", q, limit, offset);
|
||||
}
|
||||
else{
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/search?q=%s&type=%s&limit=%d&offset=%d&market=%s", q, array_to_char(type_size, type, arr), limit, offset, market);
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/search?q=%s&type=%s&limit=%d&offset=%d", q, array_to_char(type_size, type, arr), limit, offset);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1230,7 +1231,7 @@ response Spotify::unfollow_playlist(char* playlist_id) {
|
||||
|
||||
return RestApiDelete(url);
|
||||
}
|
||||
response Spotify::get_followed_artists(char* type, char* after, int limit) {
|
||||
response Spotify::get_followed_artists(char* after, char* type, int limit) {
|
||||
char url[100];
|
||||
snprintf(url, sizeof(url), "https://api.spotify.com/v1/me/following?type=%s&after=%s&limit=%d", type, after, limit);
|
||||
|
||||
|
||||
@@ -139,8 +139,8 @@ class Spotify {
|
||||
void begin();
|
||||
/// @brief handle client requests necessary for authentication
|
||||
void handle_client();
|
||||
///@brief Check if user is authenticated
|
||||
///@return true if user is authenticated
|
||||
/// @brief Check if user is authenticated
|
||||
/// @return true if user is authenticated
|
||||
bool is_auth();
|
||||
#ifdef ENABLE_PLAYER
|
||||
///@brief Get information about the user's current playback state, including track, track progress, and active device.
|
||||
@@ -479,7 +479,7 @@ class Spotify {
|
||||
/// @param type A comma-separated list of item types to search across, needs to be set to nullptr if limit, offset or market is used and type is not used
|
||||
/// @param limit The maximum number of items to return
|
||||
/// @param offset The index of the first item to return
|
||||
/// @param market An ISO 3166-1 alpha-2 country code or the string from_token, Provide this parameter if you want to apply Track Relinking
|
||||
/// @param market An ISO 3166-1 alpha-2 country code or the string from_token. Provide this parameter if you want the list of returned items to be relevant to a particular country.
|
||||
/// @return response object containing http status code and reply
|
||||
response search(char* q,int type_size = 0, char** type = nullptr, int limit = 10, int offset = 0, char* market = nullptr);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user