소스 검색

UI: Show error if Google account has no channels

derrod 4 년 전
부모
커밋
9b57490e2c
2개의 변경된 파일11개의 추가작업 그리고 1개의 파일을 삭제
  1. 4 1
      UI/window-basic-settings-stream.cpp
  2. 7 0
      UI/youtube-api-wrappers.cpp

+ 4 - 1
UI/window-basic-settings-stream.cpp

@@ -424,7 +424,10 @@ static void get_yt_ch_title(Ui::OBSBasicSettings *ui,
 			if (IsYouTubeService(
 				    QT_TO_UTF8(ui->service->currentText()))) {
 				ui->connectedAccountText->setText(
-					QTStr("Auth.LoadingChannel.Error"));
+					ytAuth->GetLastError().isEmpty()
+						? QTStr("Auth.LoadingChannel.Error")
+						: QTStr("YouTube.AuthError.Text")
+							  .arg(ytAuth->GetLastError()));
 			}
 		}
 	}

+ 7 - 0
UI/youtube-api-wrappers.cpp

@@ -156,6 +156,13 @@ bool YoutubeApiWrappers::GetChannelDescription(
 	if (!InsertCommand(url, "application/json", "", nullptr, json_out)) {
 		return false;
 	}
+
+	if (json_out["pageInfo"]["totalResults"].int_value() == 0) {
+		lastErrorMessage =
+			"No channel(s) available on selected account";
+		return false;
+	}
+
 	channel_description.id =
 		QString(json_out["items"][0]["id"].string_value().c_str());
 	channel_description.country =