Replace Spotify username/password with access token
This commit is contained in:
@@ -277,13 +277,9 @@ void GstEnginePipeline::set_fading_enabled(const bool enabled) {
|
||||
}
|
||||
|
||||
#ifdef HAVE_SPOTIFY
|
||||
void GstEnginePipeline::set_spotify_login(const QString &spotify_username, const QString &spotify_password) {
|
||||
|
||||
spotify_username_ = spotify_username;
|
||||
spotify_password_ = spotify_password;
|
||||
|
||||
void GstEnginePipeline::set_spotify_access_token(const QString &spotify_access_token) {
|
||||
spotify_access_token_ = spotify_access_token;
|
||||
}
|
||||
|
||||
#endif // HAVE_SPOTIFY
|
||||
|
||||
QString GstEnginePipeline::GstStateText(const GstState state) {
|
||||
@@ -1052,16 +1048,13 @@ void GstEnginePipeline::SourceSetupCallback(GstElement *playbin, GstElement *sou
|
||||
#ifdef HAVE_SPOTIFY
|
||||
{
|
||||
QMutexLocker l(&instance->mutex_url_);
|
||||
if (instance->media_url_.scheme() == QStringLiteral("spotify")) {
|
||||
if (instance->media_url_.scheme() == u"spotify"_s) {
|
||||
if (g_object_class_find_property(G_OBJECT_GET_CLASS(source), "bitrate")) {
|
||||
g_object_set(source, "bitrate", 2, nullptr);
|
||||
}
|
||||
if (!instance->spotify_username_.isEmpty() &&
|
||||
!instance->spotify_password_.isEmpty() &&
|
||||
g_object_class_find_property(G_OBJECT_GET_CLASS(source), "username") &&
|
||||
g_object_class_find_property(G_OBJECT_GET_CLASS(source), "password")) {
|
||||
g_object_set(source, "username", instance->spotify_username_.toUtf8().constData(), nullptr);
|
||||
g_object_set(source, "password", instance->spotify_password_.toUtf8().constData(), nullptr);
|
||||
if (!instance->spotify_access_token_.isEmpty() && g_object_class_find_property(G_OBJECT_GET_CLASS(source), "access-token")) {
|
||||
const QByteArray access_token = instance->spotify_access_token_.toUtf8();
|
||||
g_object_set(source, "access-token", access_token.constData(), nullptr);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user