UI: Remove SendChatMessage from YoutubeApiWrappers

With the custom YouTube chat sending removed in the parent commit,
there's no need to keep these functions anymore.

Effectively reverts 49dfc113c1.
This commit is contained in:
gxalpha
2024-10-10 10:08:12 +02:00
committed by Ryan Foster
parent 4730292394
commit de31ec80ae
4 changed files with 5 additions and 27 deletions

View File

@@ -1557,11 +1557,6 @@ YouTube.Errors.livePermissionBlocked="Live streaming is unavailable on the selec
YouTube.Errors.errorExecutingTransition="Transition failed due to a backend error. Please try again in a few seconds."
YouTube.Errors.errorStreamInactive="YouTube is not receiving data for your stream. Please check your configuration and try again."
YouTube.Errors.invalidTransition="The attempted transition was invalid. This may be due to the stream not having finished a previous transition. Please wait a few seconds and try again."
# Chat errors
YouTube.Errors.liveChatDisabled="Live chat is disabled on this stream."
YouTube.Errors.liveChatEnded="Live stream has ended."
YouTube.Errors.messageTextInvalid="The message text is not valid."
YouTube.Errors.rateLimitExceeded="You are sending messages too quickly."
# Browser Dock
YouTube.DocksRemoval.Title="Clear Legacy YouTube Browser Docks"
YouTube.DocksRemoval.Text="These browser docks will be removed as deprecated:\n\n%1\nUse \"Docks/YouTube Live Control Room\" instead."

View File

@@ -406,8 +406,7 @@ bool OBSYoutubeActions::CreateEventAction(YoutubeApiWrappers *api, BroadcastDesc
blog(LOG_DEBUG, "No stream created.");
return false;
}
json11::Json json;
if (!apiYouTube->BindStream(broadcast.id, stream.id, json)) {
if (!apiYouTube->BindStream(broadcast.id, stream.id)) {
blog(LOG_DEBUG, "No stream binded.");
return false;
}
@@ -455,7 +454,7 @@ bool OBSYoutubeActions::ChooseAnEventAction(YoutubeApiWrappers *api, StreamDescr
blog(LOG_DEBUG, "No stream created.");
return false;
}
if (!apiYouTube->BindStream(selectedBroadcast, stream.id, json)) {
if (!apiYouTube->BindStream(selectedBroadcast, stream.id)) {
blog(LOG_DEBUG, "No stream binded.");
return false;
}

View File

@@ -29,7 +29,6 @@ using namespace json11;
#define YOUTUBE_LIVE_TOKEN_URL "https://oauth2.googleapis.com/token"
#define YOUTUBE_LIVE_VIDEOCATEGORIES_URL YOUTUBE_LIVE_API_URL "/videoCategories"
#define YOUTUBE_LIVE_VIDEOS_URL YOUTUBE_LIVE_API_URL "/videos"
#define YOUTUBE_LIVE_CHAT_MESSAGES_URL YOUTUBE_LIVE_API_URL "/liveChat/messages"
#define YOUTUBE_LIVE_THUMBNAIL_URL "https://www.googleapis.com/upload/youtube/v3/thumbnails/set"
#define DEFAULT_BROADCASTS_PER_QUERY "50" // acceptable values are 0 to 50, inclusive
@@ -246,7 +245,7 @@ bool YoutubeApiWrappers::InsertStream(StreamDescription &stream)
return stream.id.isEmpty() ? false : true;
}
bool YoutubeApiWrappers::BindStream(const QString broadcast_id, const QString stream_id, json11::Json &json_out)
bool YoutubeApiWrappers::BindStream(const QString broadcast_id, const QString stream_id)
{
lastErrorMessage.clear();
lastErrorReason.clear();
@@ -256,6 +255,7 @@ bool YoutubeApiWrappers::BindStream(const QString broadcast_id, const QString st
const QString url = url_template.arg(broadcast_id, stream_id);
const Json data = Json::object{};
this->broadcast_id = broadcast_id;
Json json_out;
return InsertCommand(QT_TO_UTF8(url), "application/json", "", data.dump().c_str(), json_out);
}
@@ -518,18 +518,3 @@ bool YoutubeApiWrappers::FindStream(const QString &id, json11::Json &json_out)
return true;
}
bool YoutubeApiWrappers::SendChatMessage(const std::string &chat_id, const QString &message)
{
QByteArray url = YOUTUBE_LIVE_CHAT_MESSAGES_URL "?part=snippet";
json11::Json json_in = Json::object{
{"snippet", Json::object{
{"liveChatId", chat_id},
{"type", "textMessageEvent"},
{"textMessageDetails", Json::object{{"messageText", QT_TO_UTF8(message)}}},
}}};
json11::Json json_out;
return InsertCommand(url, "application/json", "POST", json_in.dump().c_str(), json_out);
}

View File

@@ -55,7 +55,7 @@ public:
bool GetChannelDescription(ChannelDescription &channel_description);
bool InsertBroadcast(BroadcastDescription &broadcast);
bool InsertStream(StreamDescription &stream);
bool BindStream(const QString broadcast_id, const QString stream_id, json11::Json &json_out);
bool BindStream(const QString broadcast_id, const QString stream_id);
bool GetBroadcastsList(json11::Json &json_out, const QString &page, const QString &status);
bool GetVideoCategoriesList(QVector<CategoryDescription> &category_list_out);
bool SetVideoCategory(const QString &video_id, const QString &video_title, const QString &video_description,
@@ -66,7 +66,6 @@ public:
bool ResetBroadcast(const QString &broadcast_id, json11::Json &json_out);
bool StartLatestBroadcast();
bool StopLatestBroadcast();
bool SendChatMessage(const std::string &chat_id, const QString &message);
void SetBroadcastId(QString &broadcast_id);
QString GetBroadcastId();