UI: Query rtmp-services for stream key link URLs

Using the newly added stream key links in services.json from
rtmp-services, we can fetch the URLs from that source instead of
hardcoding them here. This allows us to remove service-specific code
from UI code and allows out-of-band updates to these URLs.
This commit is contained in:
Ryan Foster
2021-08-16 11:50:09 -04:00
committed by Jim
parent 97e1d6ebf1
commit e13e46839f
2 changed files with 32 additions and 55 deletions

View File

@@ -283,36 +283,21 @@ void OBSBasicSettings::UpdateKeyLink()
QString serviceName = ui->service->currentText();
QString customServer = ui->customServer->text().trimmed();
QString streamKeyLink;
if (serviceName == "Twitch") {
streamKeyLink = "https://dashboard.twitch.tv/settings/stream";
} else if (serviceName.startsWith("YouTube")) {
streamKeyLink = "https://www.youtube.com/live_dashboard";
} else if (serviceName.startsWith("Restream.io")) {
streamKeyLink =
"https://restream.io/settings/streaming-setup?from=OBS";
} else if (serviceName == "Luzento.com - RTMP") {
streamKeyLink =
"https://cms.luzento.com/dashboard/stream-key?from=OBS";
} else if (serviceName == "Facebook Live" ||
(customServer.contains("fbcdn.net") && IsCustomService())) {
obs_properties_t *props = obs_get_service_properties("rtmp_common");
obs_property_t *services = obs_properties_get(props, "service");
OBSData settings = obs_data_create();
obs_data_release(settings);
obs_data_set_string(settings, "service", QT_TO_UTF8(serviceName));
obs_property_modified(services, settings);
streamKeyLink = obs_data_get_string(settings, "stream_key_link");
if (customServer.contains("fbcdn.net") && IsCustomService()) {
streamKeyLink =
"https://www.facebook.com/live/producer?ref=OBS";
} else if (serviceName.startsWith("Twitter")) {
streamKeyLink = "https://studio.twitter.com/producer/sources";
} else if (serviceName.startsWith("YouStreamer")) {
streamKeyLink = "https://app.youstreamer.com/stream/";
} else if (serviceName == "Trovo") {
streamKeyLink = "https://studio.trovo.live/mychannel/stream";
} else if (serviceName == "Glimesh") {
streamKeyLink = "https://glimesh.tv/users/settings/stream";
} else if (serviceName.startsWith("OPENREC.tv")) {
streamKeyLink =
"https://www.openrec.tv/login?keep_login=true&url=https://www.openrec.tv/dashboard/live?from=obs";
} else if (serviceName == "Brime Live") {
streamKeyLink = "https://brimelive.com/obs-stream-key-link";
} else if (serviceName == "Bilibili Live") {
streamKeyLink =
"https://link.bilibili.com/p/center/index#/my-room/start-live";
}
if (serviceName == "Dacast") {
@@ -323,12 +308,14 @@ void OBSBasicSettings::UpdateKeyLink()
QTStr("Basic.AutoConfig.StreamPage.StreamKey"));
}
if (QString(streamKeyLink).isNull()) {
if (QString(streamKeyLink).isNull() ||
QString(streamKeyLink).isEmpty()) {
ui->getStreamKeyButton->hide();
} else {
ui->getStreamKeyButton->setTargetUrl(QUrl(streamKeyLink));
ui->getStreamKeyButton->show();
}
obs_properties_destroy(props);
}
void OBSBasicSettings::LoadServices(bool showAll)