diff --git a/src/conffile.c b/src/conffile.c index da49f03d..9f0d8e48 100644 --- a/src/conffile.c +++ b/src/conffile.c @@ -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() }; diff --git a/src/inputs/spotify_librespotc.c b/src/inputs/spotify_librespotc.c index 7b47938e..05cb91ae 100644 --- a/src/inputs/spotify_librespotc.c +++ b/src/inputs/spotify_librespotc.c @@ -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;