Notice: This forum has been recovered from an old backup, so some content, links, and dates may be outdated. The forum is currently read-only while we restore sign-in and registration functionality. Details

If you find this forum valuable and would like to help keep it online, donations to help cover hosting and domain costs are greatly appreciated, but never expected. You can support the forum through Buy Me a Coffee or Ko-fi. Thank you for helping preserve the EventGhost community.

Support for XBMC2 plugin (formerly XBMCRepeat)

Questions and comments specific to a particular plugin should go here.
gechu
Experienced User
Posts: 58
Joined: Sat Jan 07, 2012 10:35 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by gechu »

Hi!

Trying to get the call:

Code: Select all

JSON-RPC->Player->GetActivePlayers->(No parameters)
working in Gotham. I┬┤m using the second latest release (not the debug version).

Anyone has it working in Gotham?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

gechu wrote:Trying to get the call:
Something seems to work differently as an empty parameter don't seem to work at the moment.
Put in:

Code: Select all

{}
or

Code: Select all

[]
as the parameter and it should work. I will look into whats wrong later.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
gechu
Experienced User
Posts: 58
Joined: Sat Jan 07, 2012 10:35 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by gechu »

This worked:

Code: Select all

[]


BTW, I┬┤m buying you a beer + pizza for the great work you put into this plugin! Thank you!
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

gechu wrote:This worked:

Code: Select all

[]
Great.
BTW, I┬┤m buying you a beer + pizza for the great work you put into this plugin! Thank you!
Nice, I was getting a bit hungry. :D

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
gechu
Experienced User
Posts: 58
Joined: Sat Jan 07, 2012 10:35 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by gechu »

:)

Need to implement some sort of smart pause-function that would only trigger an XBMC pause command if a video or music is playing.

First I run "Player.GetActivePlayers" with the "[]" parameters to retrieve the current player in an event payload: eg.result[0]["playerid"]

To embed that Python variable in an JSON call, I noticed that you┬┤ve built a function to seaches for "{{" called "def ParseString2(text, filterFunc=None):". Problem seems to be that the ParseString2 isn┬┤t getting called, because when I run "Player.GetProperties" with the string:

Code: Select all

{ "playerid":{{eg.result[0]["playerid"]}}, "properties": ["speed"]}
The dynamic part isn┬┤t correcly evaluated to the value received in the previous call to "Player.GetActivePlayers".

This is the trace:

Code: Select all

08:23:17   Traceback (most recent call last) (1640):
08:23:17     File "C:\Program Files Portable\EventGhost\eg\Classes\TaskletDialog.py", line 59, in ProcessingTask
08:23:17       self.Configure(*args, **kwargs)
08:23:17     File "C:\Program Files Portable\EventGhost\eg\Classes\ConfigDialog.py", line 165, in Configure
08:23:17       treeItem.Configure(*args)
08:23:17     File "C:\Program Files Portable\EventGhost\eg\Classes\ActionItem.py", line 101, in Configure
08:23:17       return self.executable.Configure(*args)
08:23:17     File "C:\Program Files Portable\EventGhost\plugins\XBMCRepeat\__init__.py", line 1144, in Configure
08:23:17       if 'jsonrpc' in json.loads(textControl2.GetValue()):
08:23:17     File "json\__init__.pyc", line 307, in loads
08:23:17     File "json\decoder.pyc", line 319, in decode
08:23:17     File "json\decoder.pyc", line 336, in raw_decode
08:23:17     File "json\scanner.pyc", line 55, in iterscan
08:23:17     File "json\decoder.pyc", line 183, in JSONObject
08:23:17     File "json\scanner.pyc", line 55, in iterscan
08:23:17     File "json\decoder.pyc", line 171, in JSONObject
08:23:17   ValueError: Expecting property name: line 1 column 14 (char 14)
Now I┬┤m using the latest version of the plugin. Any ideas of where the issue may lie?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

gechu wrote:The dynamic part isn┬┤t correcly evaluated to the value received in the previous call to "Player.GetActivePlayers".
Try this:

Code: Select all

{{eg.result[0]['playerid']}},['speed']
It works for me, but I'm having a weird lock up problem editing the parameter so I will have to look into it.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
Pliind
Experienced User
Posts: 50
Joined: Tue Dec 31, 2013 7:40 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by Pliind »

Hey guys!

I'm using XBMC with a plugin called Plexbmc. So i'm using my plexserver with xbmc.

I've got basicly everything working in the plugin except for "get current playing filename"

This is my error.

Code: Select all

   Error in Action: "XBMC2: GetCurrentlyPlayingFilename"
   Traceback (most recent call last) (1640):
     File "C:\Program Files (x86)\EventGhost\eg\Classes\ActionBase.py", line 170, in CallWrapper
       return self(*args)
     File "C:\Program Files (x86)\EventGhost\plugins\XBMCRepeat\__init__.py", line 690, in __call__
       responce = self.plugin.JSON_RPC.send('Player.GetActivePlayers')
     File "C:\Program Files (x86)\EventGhost\plugins\XBMCRepeat\__init__.py", line 681, in send
       return json.loads(responce)
     File "json\__init__.pyc", line 307, in loads
     File "json\decoder.pyc", line 319, in decode
     File "json\decoder.pyc", line 338, in raw_decode
   ValueError: No JSON object could be decoded
Is this because XBMC just as Plex has no idea what it is currently playing? there is no "filename" because it's on the plexserver?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

Pliind wrote:I've got basicly everything working in the plugin except for "get current playing filename"
It hasn't worked for a while I will probably remove it in the next release. You will need to use the JSON-RPC actions to get the filename.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
Pliind
Experienced User
Posts: 50
Joined: Tue Dec 31, 2013 7:40 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by Pliind »

jonib wrote:
Pliind wrote:I've got basicly everything working in the plugin except for "get current playing filename"
I hasn't worked for a while I will probably remove it in the next release. You will need to use the JSON-RPC actions to get the filename.

jonib
Yeah i did a bit of back-tracking in the thread, so Iv'e also updated my plugin.

Could I ask you for the code to put into JSON-RPC to get "playing now"? i've tried the scripts found further back but i keep getting errors :( connection seams fine, if i pause or press play in XBMC my EG log shows currently playing.

(why i want currently playing in plain text is because i want to display this on my iMon display)
Pliind
Experienced User
Posts: 50
Joined: Tue Dec 31, 2013 7:40 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by Pliind »

Ok so i finally found the solution to getting what's being played printed.


Anyways here it is for anybody looking.

Code: Select all

PlayerID = eg.plugins.XBMC2.JSONRPC(u'Player.GetActivePlayers', u'', False)[0]['playerid']
eg.result = eg.plugins.XBMC2.JSONRPC(u'Player.GetItem', u"["+str(PlayerID)+",['title']]", False)
(Thanks Jonib @ page 51)

i made a slight change so i only get title back.

This is what is output to the log.

Code: Select all

   {u'item': {u'title': u'', u'type': u'unknown', u'label': u'filename.mp4'}}
So the scriptkiddy that i am, managed to do this. Hopefully some other's might find something usefull
Make a Python Script.
So there might be 1000 ways to do this easier, but yeah I'm a noob so deal with it :) oh and im using PleXBMC so my settings might not fit all. (it's the split that determins what you crop and filter kinda)

Code: Select all

PlayerID = eg.plugins.XBMC2.JSONRPC(u'Player.GetActivePlayers', u'', False)[0]['playerid']
eg.result = eg.plugins.XBMC2.JSONRPC(u'Player.GetItem', u"["+str(PlayerID)+",['title']]", False)
print eg.result

b = str(eg.result)
b = b.split(" ",6)
playing=b[6]
eg.globals.playing = playing
print eg.globals.playing

c = str(eg.globals.playing)
c = c.split("'",10)
title=c[3]
eg.globals.title = title
print eg.globals.title

d = str(eg.globals.title)
d = d.split(".")
show=d[0]
eg.globals.show = show
print eg.globals.show
MikeD82
Posts: 2
Joined: Tue Jul 08, 2014 4:13 pm

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by MikeD82 »

Need some help running the following Json url command in the plugin.

http://192.168.1.20:8080/jsonrpc?reques ... sume":true}}}

I can get the file to play by running:
JSONRPC Namespace:Player Method:Open
[{"file":"{{eg.globals.playing}}"}]

eg.globals.playing=file path

That starts the video at the beginning. I would like to resume the video or atleast ask me if I would like to resume the movie.

Any ideas?
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

MikeD82 wrote:Need some help running the following Json url command in the plugin.

http://192.168.1.20:8080/jsonrpc?reques ... sume":true}}}

I can get the file to play by running:
JSONRPC Namespace:Player Method:Open
[{"file":"{{eg.globals.playing}}"}]

eg.globals.playing=file path

That starts the video at the beginning. I would like to resume the video or atleast ask me if I would like to resume the movie.

Any ideas?
I'm having big PC related problems at the moment so can't do any real development/debugging, I don't even get e-mails correctly. :cry:

I think this should be the correct syntax, but I think there is a problem in the plugin so it might not work even if it's "correct":

Code: Select all

[{"file":"{{eg.globals.playing}}","options":{"resume":true}}]
Unfortunately I have no idea when I might be able to look into/fix any related problems.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
steve1977
Posts: 17
Joined: Sun Dec 01, 2013 8:50 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by steve1977 »

I'll be making another attempt to use and configure the remote. What would be the latest version? Is the one included in the June version of EG the latest? Thanks in advance!
jonib
Plugin Developer
Posts: 1328
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by jonib »

steve1977 wrote:I'll be making another attempt to use and configure the remote. What would be the latest version? Is the one included in the June version of EG the latest? Thanks in advance!
Very sorry for the late reply.
0.6.14 is included with EventGhost.
I don't think I have made any changes/fixes for the apple remote.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
simonturk
Posts: 1
Joined: Tue Sep 02, 2014 2:16 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Post by simonturk »

Hi Guys,

Sorry for jumping on your thread but hoping you can help me - and then I can get out of your hair!

When using XBMC2 commands i.e. Open Window: Movies no control is passed to XBMC. I used the XBMC Log to track JSON and nothing was logged. To make sure I would see something logged I performed the same command with an iPhone app and sure enough the JSON is registered by XBMC.

So, after many hours pulling my hair out (not complaining I think you do a great job) I found that if i manually send the command using your experimental action "Send Any JSON" I can get it to work.

It seems to me there is some problem sending JSON with the builtin commands? My work around is OK but it is slow going, and kind of defeats the purpose of the plugin.

Any idea on what the problem may be?

Machine: Windows 7
XBMC: Gotham (cna't remember exact version at the moment)

Thanks,

Simon
Post Reply