2014-01-06, 15:39
(2014-01-06, 06:24)giftie Wrote: As da-anda had stated, you should be able to query the Stereopic setting using JSONRPC.Hello giftie,
For Example:
This gives the setting from the video screen settingsCode:{"jsonrpc": "2.0", "method": "Settings.GetSettingValue", "params": { "setting": "videoscreen.stereoscopicmode" }, "id": 1}
Reading the current Stereoscopic mode has been implemented with a bit different json that gives the actual string of the mode instead of emun. As has been explained earlier - enums may change, while strings should not.
Code:
import xbmc
import simplejson
def getStereoscopicMode():
query = '{"jsonrpc": "2.0", "method": "GUI.GetProperties", "params": {"properties": ["stereoscopicmode"]}, "id": 1}'
result = xbmc.executeJSONRPC(query)
json = simplejson.loads(result)
print json
ret = 'unknown'
if json.has_key('result'):
if json['result'].has_key('stereoscopicmode'):
if json['result']['stereoscopicmode'].has_key('mode'):
ret = json['result']['stereoscopicmode']['mode'].encode('utf-8')
#"off", "split_vertical", "split_horizontal", "row_interleaved", "hardware_based", "anaglyph_cyan_red", "anaglyph_green_magenta", "monoscopic"
return ret
Now the problem is on actual detection of the change event.
da-anda Wrote:@Pavel unfortunately there is no way around polling atm. Or you check only on playback start/stop which should be announced in python
Hello da-anda,
Polling with jsonrpc querying is an overkill.
Only checking Play/Stop announcements is limiting addon functionality as Stereoscopic mode can be changed after Playback has started OR in System settings directly.
I can stick with a combination of both polling and Play/Stop announcements, but that is a workaround only.
Having announcement from StereoscipicManager would be perfect solution. Cheers