Livin wrote:Examples please

I don't have much time right now so hope these work, if you need I'll post other examples tomorrow.
OK, this first one is a macro paste it somewhere in your EventGhost config:
- Code: Select all
<?xml version="1.0" encoding="UTF-8" ?>
<EventGhost Version="1568">
<Macro Name="XBMC2 #: JSONRPC: get showname and episodename" Expanded="True">
<Event Name="XBMC2.Player.OnPlay.episode" />
<Action>
XBMC2.JSONRPC(u'VideoLibrary.GetEpisodeDetails', u"[{{eg.event.payload['item']['id']}},['tvshowid']]", True)
</Action>
<Action>
XBMC2.JSONRPC(u'VideoLibrary.GetTVShowDetails', u"[{{eg.result['episodedetails']['tvshowid']}}]", True)
</Action>
<Action>
EventGhost.ShowOSD(u"{eg.result['tvshowdetails']['label']}", u'0;-24;0;0;0;700;0;0;0;1;0;0;2;32;Arial', (255, 255, 255), (0, 0, 0), 0, (0, 0), 1, 3.0, False)
</Action>
</Macro>
</EventGhost>
The macro will react to a
XBMC2.Player.OnPlay.episode event. The first JSONRPC action will use the
episodeid from the event payload and it returns information about the episode, including the
tvshowid that is needed in the second JSON-RPC action. The second JSON-RPC action returns information about the show.
The ShowOSD action should display the show name.
The code below is similar but needs to be put in a
Python script action, it shows it's easier to get both episode name and show name when using a script.
- Code: Select all
Episode = eg.plugins.XBMC2.JSONRPC(u'VideoLibrary.GetEpisodeDetails', u"["+str(eg.event.payload['item']['id'])+",['tvshowid']]", False)
print 'Episode:',Episode['episodedetails']['label']
Show = eg.plugins.XBMC2.JSONRPC(u'VideoLibrary.GetTVShowDetails', u"["+str(Episode['episodedetails']['tvshowid'])+"]", False)
print 'Show:',Show['tvshowdetails']['label']
eg.result = Show['tvshowdetails']['label']+': '+Episode['episodedetails']['label']
If you put this in a Python script and below it a ShowOSD action with this
{eg.result} in the text area it should show both show title and episode name.
If these examples are hard to follow give me a specific example how you want to use the information and I'll make a better example.
jonib