mirror of
https://github.com/owntone/owntone-server.git
synced 2025-02-05 02:38:09 -05:00
[spotify] Remove logging of "No spotify refresh token found"
Logged every time the web UI is used due to call to /api/spotify and during initscan, but it isn't an error, it just means the user isn't logged in. Fixes #1701.
This commit is contained in:
parent
045edf7c55
commit
2fa80b2fd9
@ -488,15 +488,13 @@ token_refresh(struct spotify_credentials *credentials)
|
|||||||
|
|
||||||
if (credentials->token_time_requested && difftime(time(NULL), credentials->token_time_requested) < credentials->token_expires_in)
|
if (credentials->token_time_requested && difftime(time(NULL), credentials->token_time_requested) < credentials->token_expires_in)
|
||||||
{
|
{
|
||||||
DPRINTF(E_DBG, L_SPOTIFY, "Spotify token still valid\n");
|
return 0; // Spotify token still valid
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ret = db_admin_get(&refresh_token, DB_ADMIN_SPOTIFY_REFRESH_TOKEN);
|
ret = db_admin_get(&refresh_token, DB_ADMIN_SPOTIFY_REFRESH_TOKEN);
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_SPOTIFY, "No spotify refresh token found\n");
|
return -1; // No refresh token (user not logged in)
|
||||||
goto error;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DPRINTF(E_DBG, L_SPOTIFY, "Spotify refresh-token: '%s'\n", refresh_token);
|
DPRINTF(E_DBG, L_SPOTIFY, "Spotify refresh-token: '%s'\n", refresh_token);
|
||||||
@ -512,14 +510,18 @@ token_refresh(struct spotify_credentials *credentials)
|
|||||||
}
|
}
|
||||||
|
|
||||||
ret = request_access_tokens(credentials, &kv, &err);
|
ret = request_access_tokens(credentials, &kv, &err);
|
||||||
|
if (ret < 0)
|
||||||
|
{
|
||||||
|
DPRINTF(E_LOG, L_SPOTIFY, "Error requesting access token: %s", err);
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
|
||||||
if (ret == 0)
|
request_user_info(credentials);
|
||||||
request_user_info(credentials);
|
|
||||||
|
|
||||||
free(refresh_token);
|
free(refresh_token);
|
||||||
keyval_clear(&kv);
|
keyval_clear(&kv);
|
||||||
|
|
||||||
return ret;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
free(refresh_token);
|
free(refresh_token);
|
||||||
@ -1891,12 +1893,8 @@ spotifywebapi_library_initscan(void)
|
|||||||
CHECK_ERR(L_SPOTIFY, pthread_mutex_unlock(&spotify_credentials.lock));
|
CHECK_ERR(L_SPOTIFY, pthread_mutex_unlock(&spotify_credentials.lock));
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
{
|
{
|
||||||
DPRINTF(E_LOG, L_SPOTIFY, "Spotify webapi token refresh failed. "
|
// User not logged in or error refreshing token
|
||||||
"In order to use Spotify, authorize the server to access your saved "
|
|
||||||
"tracks by visiting http://owntone.local:3689\n");
|
|
||||||
|
|
||||||
db_spotify_purge();
|
db_spotify_purge();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1911,7 +1909,6 @@ spotifywebapi_library_initscan(void)
|
|||||||
"provide valid credentials by visiting http://owntone.local:3689\n");
|
"provide valid credentials by visiting http://owntone.local:3689\n");
|
||||||
|
|
||||||
db_spotify_purge();
|
db_spotify_purge();
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user