[spotify] Set the new protocol as experimental and fallback, old one as default

This commit is contained in:
ejurgensen 2025-02-23 23:43:51 +01:00
parent 2547336576
commit 038c741052
2 changed files with 12 additions and 0 deletions

View File

@ -217,6 +217,7 @@ static cfg_opt_t sec_spotify[] =
CFG_BOOL("base_playlist_disable", cfg_false, CFGF_NONE),
CFG_BOOL("artist_override", cfg_false, CFGF_NONE),
CFG_BOOL("album_override", cfg_false, CFGF_NONE),
CFG_BOOL("disable_legacy_mode", cfg_false, CFGF_NONE),
CFG_END()
};

View File

@ -486,6 +486,10 @@ setup(struct input_source *source)
return 0;
error:
// This should be removed when we don't default to legacy mode any more
DPRINTF(E_INFO, L_SPOTIFY, "Switching off Spotify legacy mode\n");
librespotc_legacy_set(ctx->session, false);
pthread_mutex_unlock(&spotify_ctx_lock);
stop(source);
@ -617,6 +621,13 @@ login(const char *username, const char *token, const char **errmsg)
if (!ctx->session)
goto error;
// For now, use old tcp based protocol as default unless configured not to.
// Note that setup() will switch the old protocol off on error.
if (!cfg_getbool(cfg_getsec(cfg, "spotify"), "disable_legacy_mode"))
librespotc_legacy_set(ctx->session, true);
else
DPRINTF(E_INFO, L_SPOTIFY, "Using experimental http protocol for Spotify\n");
ret = postlogin(ctx);
if (ret < 0)
goto error;