Kodi Community Forum

Full Version: GUI.ActivateWindow with window "subtitlesearch"
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I'm having some trouble activating the subtitle search window using JSON-RPC, mainly through TCP, and i suspect there might be a bug somewhere (but i'm not sure).

This is what i'm doing:

1. I'm calling GUI.ActivateWindow with "subtitlesearch" as the window parameter, through TCP. The request is:
[{"jsonrpc":"2.0","id":1,"method":"GUI.ActivateWindow","params":{"window":"subtitlesearch"}}]

2. The subtitle search appears on XBMC;

3. I get a Player.OnPause notification from XBMC;

4. I get nothing else from the socket while the subtitle search window is showing on XBMC.
4.1 I don't get the OK response to the GUI.ActivateWindow
4.2 Any other call to JSON-RPC through that socket doesn't get a response.

5. If i remove the subtitles window by other means (using the keyboard for instance), i get the responses to all the calls that got queued up, including the original GUI.ActivateWindow.

Looks like, while the subtitle window is showing, XBMC doesn't listen to or respond on the socket.

Something similar happens through HTTP, but as this is stateless, i can issue new calls and they get acknowledged (the GUI.ActivateWindow call just timeouts - if i don't let it timeout, i only get the acknowledge when the window is dismissed).

BTW, calls to GUI.ActivateWindow with other window parameters work correctly.

I'm on Linux, with XBMC 13.1, but the same thing has happened in Windows with a Gotham Beta.

Can someone confirm this, or am i doing something wrong. Any help is appreciated.

Thanks
IIRC this is a general problem in XBMC. Modal dialogs can completely block other threads (including the one that is responsible for interacting with the TCP socket used for JSON-RPC) from doing anything.
Thanks for the info and the quick response.

To work around this, i'm planning on making this particular call through HTTP, so as not to block the TCP socket thread on XBMC. I've tried it, and it works: i call GUI.ActivateWindow through HTTP, ignore its response and let it timeout. I can then continue making TCP calls (even with the subtitle dialog showing), to which XBMC responds.

Not ideal, but it's the best i came up with. If anyone has a better way to handle this, i would love to hear it.

Once again thanks!
For this specific window you may prefer to use EventServer "ActivateWindow(SubtitleSearch)" since to activate TCP socket you need to also activate EventServer unlike needing to activate webserver just for this purpose.
@Tolriq, thanks, that's true. But i'm already requiring the webserver to be enabled, to fetch images (i didn't look for a way to fetch them through TCP, i might take a look), and i'm currently relying exclusively on JSON-RPC, so i would prefer to avoid supporting another protocol (kind of lazy, i know...).