Support for XBMC2 plugin (formerly XBMCRepeat)

Questions and comments specific to a particular plugin should go here.

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Postby egbaud » Sun Aug 06, 2017 9:08 pm

How do I translate this: xbmc.VideoLibrary.RemoveMovie(movieid=1234) into XBMC2 form.

I know the first part is eg.plugins.XBMC2.JSONRPC(u'VideoLibrary.RemoveMovie', ????), but how do I encode the "movieid=1234" part?
egbaud
 
Posts: 35
Joined: Tue Mar 18, 2014 1:30 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Postby jonib » Sun Aug 06, 2017 9:59 pm

egbaud wrote:How do I translate this: xbmc.VideoLibrary.RemoveMovie(movieid=1234) into XBMC2 form.

I know the first part is eg.plugins.XBMC2.JSONRPC(u'VideoLibrary.RemoveMovie', ????), but how do I encode the "movieid=1234" part?


Code: Select all
eg.plugins.XBMC2.JSONRPC(u'VideoLibrary.RemoveMovie', [1234] )

or

Code: Select all
eg.plugins.XBMC2.JSONRPC(u'VideoLibrary.RemoveMovie', {"movieid": 1234} )


I did not test but should work, post again if not.

jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
jonib
Plugin Developer
 
Posts: 1237
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Postby egbaud » Mon Aug 07, 2017 5:32 pm

Thank you! Worked perfectly.
egbaud
 
Posts: 35
Joined: Tue Mar 18, 2014 1:30 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Postby MaxMan23 » Mon Aug 14, 2017 10:25 am

Hello. Can someone help me with a python script. I want to send clear signals for play pause (not toggle). If an Event comes for Pause a script should be executed. And if an Event comes for Play another script should be executed.

Someone wrote this as an example:
def getVideoPlaying():
videoPlaying = 0
activePlayer = eg.plugins.XBMC2.JSONRPC(u'Player.GetActivePlayers', u'', False)
if activePlayer:
if activePlayer[0]["type"] == "video":
mediaSpeed = eg.plugins.XBMC2.JSONRPC(u'Player.GetProperties', u'1,["speed"]', False)["speed"]
if mediaSpeed > 0:
videoPlaying = 1
return videoPlaying


I need something like this (for Pause):
def getVideoPlaying():
videoPlaying = 0
activePlayer = eg.plugins.XBMC2.JSONRPC(u'Player.GetActivePlayers', u'', False)
if activePlayer:
if activePlayer[0]["type"] == "video":
mediaSpeed = eg.plugins.XBMC2.JSONRPC(u'Player.GetProperties', u'1,["speed"]', False)["speed"]
if mediaSpeed > 1:
eg.plugins.XBMC2.JSONRPC(u'Player.PlayPause.....



Here is an Json Example:
{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": { "playerid": 0 }, "id": 1}


Can someone help me with the right format for the script, please. And can anyone tell me if this could work?
MaxMan23
 
Posts: 17
Joined: Sat Jun 29, 2013 4:36 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Postby jonib » Mon Aug 14, 2017 3:16 pm

MaxMan23 wrote:Hello. Can someone help me with a python script. I want to send clear signals for play pause (not toggle). If an Event comes for Pause a script should be executed. And if an Event comes for Play another script should be executed.
[Code removed]
Can someone help me with the right format for the script, please. And can anyone tell me if this could work?
I would start with these actions:
Code: Select all
XBMC2->Actions->Media playing->Play
XBMC2->Actions->Media playing->Pause
"Play" will only start playback and resume playback if paused, "Pause" will pause and resume playback if paused but not start.

As "Pause" works as a semi toggle, try this for a pure pause, something must be playing for it to work:
Code: Select all
{"jsonrpc": "2.0", "method": "Player.PlayPause", "params": {"playerid": 1, "play": False}, "id": 1}


jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
jonib
Plugin Developer
 
Posts: 1237
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Postby MaxMan23 » Tue Aug 15, 2017 10:31 am

"Pause" will pause and resume playback if paused but not start.


If i press Pause two times, playback should not start again.

Can you help me with the right format:
eg.plugins.XBMC2.JSONRPC(u'Player.PlayPause
MaxMan23
 
Posts: 17
Joined: Sat Jun 29, 2013 4:36 am

Re: Support for XBMC2 plugin (formerly XBMCRepeat)

Postby jonib » Tue Aug 15, 2017 2:59 pm

MaxMan23 wrote:Can you help me with the right format:


Put this in a "Python script" action:
Code: Select all
activePlayer = eg.plugins.XBMC2.JSONRPC(u'Player.GetActivePlayers', u'', False)
if activePlayer:
    eg.plugins.XBMC2.JSONRPC(u'Player.PlayPause', u'{0},False'.format(activePlayer[0]['playerid']), False)


jonib
XBMC2 plugin to control XBMC. If you want to flatter me Image
jonib
Plugin Developer
 
Posts: 1237
Joined: Thu Mar 26, 2009 9:33 pm
Location: Sweden

Previous

Return to Plugin Support

Who is online

Users browsing this forum: No registered users and 1 guest

cron