-
-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix GetGroupSceneItemList #105
base: master
Are you sure you want to change the base?
Conversation
jsTron
commented
Sep 8, 2022
- Fix string conversion in GetGroupSceneItemList.
- Refactor get scene list method in test client and support top level groups.
@@ -1744,7 +1744,7 @@ public List<JObject> GetGroupSceneItemList(string sceneName) | |||
}; | |||
|
|||
var response = SendRequest(nameof(GetGroupSceneItemList), request); | |||
return JsonConvert.DeserializeObject<List<JObject>>((string)response["sceneItems"]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All other functions are in the format of (type)resonse["keyName"]
is there a reason we're changing it here?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The deserialization does not like the direct cast here, causing the request to hang. Now that you have me thinking, maybe changing List to something like a JArray could work as well.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
When I was testing with my code, it was failing on line 1747 saying it couldn't convert from Array to String but I changed it to this and got it to work:
return JsonConvert.DeserializeObject<List<SceneItemDetails>>(response["sceneItems"].ToString());
You'll notice I also changed the overall function to return as SceneItemDetails like it was before but apparently for whatever reason the (string) isn't allowed whereas .ToString() is fine.
|
||
tvScenes.Nodes.Clear(); | ||
foreach (var scene in scenes) | ||
{ | ||
var node = new TreeNode(scene.Name); | ||
var sources = new List<SceneItemDetails>(); | ||
sources.AddRange(obs.GetSceneItemList(scene.Name)); | ||
foreach (var item in sources) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we need all this in the test client?
Overall groups should be avoided per the Websocket documentation:
"Using groups at all in OBS is discouraged, as they are very broken under the hood."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we don't. If I recall correctly, the previous code received and used that info for free from the old API. I was operating under the premise that I would mimic that behavior.
* Fix string conversion in GetGroupSceneItemList. * Refactor get scene list method in test client and support top level groups.
908a729
to
44c722b
Compare