Add twitch url check

This commit is contained in:
Exeldro 2024-07-17 08:50:12 +02:00
parent 754c82e5ee
commit e164453417
No known key found for this signature in database
GPG Key ID: 97269A83FC715751

View File

@ -67,7 +67,8 @@ bool obs_module_load(void)
void obs_module_post_load()
{
multistream_dock->LoadVerticalOutputs(true);
if (multistream_dock)
multistream_dock->LoadVerticalOutputs(true);
}
void obs_module_unload()
@ -106,9 +107,11 @@ void RemoveWidget(QWidget *widget)
}
// Platform icons deciphered from endpoints
QIcon MultistreamDock::getPlatformFromEndpoint(QString endpoint) {
QIcon MultistreamDock::getPlatformFromEndpoint(QString endpoint)
{
if (endpoint.contains(QString::fromUtf8(".contribute.live-video.net"))) { // twitch
if (endpoint.contains(QString::fromUtf8(".contribute.live-video.net")) ||
endpoint.contains(QString::fromUtf8(".twitch.tv"))) { // twitch
return platformIconTwitch;
} else if (endpoint.contains(QString::fromUtf8(".youtube.com"))) { // youtube
return platformIconYouTube;
@ -118,14 +121,13 @@ QIcon MultistreamDock::getPlatformFromEndpoint(QString endpoint) {
return platformIconTikTok;
} else if (endpoint.contains(QString::fromUtf8(".pscp.tv"))) { // twitter
return platformIconTwitter;
} else if (endpoint.contains(QString::fromUtf8("livepush.trovo.live/live"))) { // trovo
} else if (endpoint.contains(QString::fromUtf8("livepush.trovo.live"))) { // trovo
return platformIconTrovo;
} else if (endpoint.contains(QString::fromUtf8(".facebook.com"))) { // facebook
return platformIconFacebook;
} else { // unknown
return platformIconUnknown;
}
}
// Output button styling
@ -141,13 +143,12 @@ void MultistreamDock::outputButtonStyle(QPushButton *button)
}
// Common styling things here
auto canvasGroupStyle = QString("padding: 0px 0px 0px 0px;"); // Main Canvas, Vertical Canvas
auto canvasGroupStyle = QString("padding: 0px 0px 0px 0px;"); // Main Canvas, Vertical Canvas
auto canvasGroupHeaderStyle = QString("padding: 0px 0px 0px 0px; font-weight: bold;"); // header of each group
auto outputTitleStyle = QString("QLabel{}"); // "Built -in stream"
auto outputTitleStyle = QString("QLabel{}"); // "Built -in stream"
auto outputGroupStyle = QString("background-color: %1; padding: 0px;")
.arg(QPalette().color(QPalette::ColorRole::Mid).name(QColor::HexRgb)); // wrapper around above
// For showing warning for no vertical integration
void showVerticalWarning(QVBoxLayout *verticalLayout)
{
@ -553,7 +554,6 @@ void MultistreamDock::LoadOutput(obs_data_t *data, bool vertical)
auto l2 = new QHBoxLayout;
auto platformIconLabel = new QLabel;
auto platformIcon = getPlatformFromEndpoint(endpoint);
@ -892,7 +892,7 @@ void MultistreamDock::LoadVerticalOutputs(bool firstLoad)
struct calldata cd;
calldata_init(&cd);
if (!proc_handler_call(ph, "aitum_vertical_get_stream_settings", &cd)) {
if (firstLoad) { // only display warning on first load
if (firstLoad) { // only display warning on first load
showVerticalWarning(verticalCanvasOutputLayout); // show warning
}
calldata_free(&cd);