Author Topic: Launch Plugins for XBMC  (Read 3924 times)

0 Members and 1 Guest are viewing this topic.

Indy

  • $upporter
  • Jr. Member
  • *****
  • Posts: 23
  • Karma: 1
    • View Profile
Launch Plugins for XBMC
« on: February 08, 2014, 03:15:35 AM »
Hi Everyone,

2 questions, first is probably easy, 2nd I hope is.

1. how do I open plugins in XBMC?  I want to say "Watch TV" and it open us the correct plugin in XBMC.   I tried XBMC.Execbuiltin Runaddon (script.plugin.name) from another example I found but that didn't open anything.  Also is there easy detection to see if XBMC is already open, if so give it focus and then run and if not open it first and then open plugin.  hahaha, seems complicated even to explain it, maybe just the opening plugin would be helpful. Maybe XBMC is already smart and does that if I issue the right json command.

2. I also watch Live TV from my XBMC and I have most of working via voice.  I want to be able to change to a certain channels via voice.  Not sure if there is an easier way.  For example, if I want to change channel to one hundred, I need Vox to keyboard press 1 0 0 <enter>.  I'm sure it would work if I spelled it out like that, but I was hoping it could be more natural.  Not sure the difficulty on this.

Any help is appreciated, feel like I'm starting to understand this, these forums are a wealth on information.


****Edit****

I guess I should also mention I'm not using the same LiveTV as the other topic of XBMC + LiveTV + Vox so its a little different.
« Last Edit: February 08, 2014, 03:18:56 AM by Indy »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Launch Plugins for XBMC
« Reply #1 on: February 08, 2014, 04:35:26 AM »
Hi Indy,

I can help you for these question:

Quote
Also is there easy detection to see if XBMC is already open, if so give it focus and then run and if not open it first and then open plugin.

VC has in the Logic Command Builder (LCB) a function which is called "Add logic". This insert a logic block (if-then-else) which you can use as follow example:
IF ->Logic Type: ProcessRunning ->XBMC   THEN->action: Window.Focus  parameter: XBMC  ELSE ->action: Launch.RawParam parameter:{path.pfx86}\XBMC\XBMC.exe

This command check if XBMC is running and if yes it focuses it. If XBMC is not running, it will start XBMC.

A answer at you second question: You can use a payload with Phrase/Value. For example: You channel 100 is called BBCNews, so you can use in the payload different phrases (separated with a comma) for this channel like "News, BBC, BBC News, 100, what ever..." and as Value the keyboard press sequence (at best with the DxInput plugin, because it allowed you more control for keypress delays). You can use this example code to have a start (save the attached indychanneltest.xml in the VC payload folder) and you must enable the DxInput plugin in VoxCommando.

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="channel select INDY" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="1153" name="channel" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="This action insert the Value from payload1 followed by a return. If the sequence is to fast, you can play with the delay in the DxInput plugin settings (25ms is a good choice)">
    <action>
      <cmdType>DxInput.Type</cmdType>
      <cmdString>{1}{return}</cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase optional="true">please, switch to, jump to</phrase>
    <phrase>select channel, channel</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\indychanneltest.xml</payloadFromXML>
  </command>
</commandGroup>

I hope this work for you.
« Last Edit: February 08, 2014, 05:21:33 AM by Kalle »
***********  get excited and make things  **********

nime5ter

  • Administrator
  • Hero Member
  • *****
  • Posts: 1999
  • Karma: 61
    • View Profile
    • Getting Started with VoxCommando
Re: Launch Plugins for XBMC
« Reply #2 on: February 08, 2014, 09:21:36 AM »
Hi Everyone,
1. how do I open plugins in XBMC?  I want to say "Watch TV" and it open us the correct plugin in XBMC.   I tried XBMC.Execbuiltin Runaddon (script.plugin.name) from another example I found but that didn't open anything.

Looks like Kalle has handled the bulk of your questions in his usual awesome manner.

With regard to XBMC Frodo plugins: All of the XBMC.xxxx actions in VC are for XBMC Eden.

For Frodo, you usually want the XJson.xxxx actions.

It's an unfortunate aspect of the forum that older posts can confuse the issue if you're not careful. As it happens, just yesterday James responded to a question about XBMC Frodo addons but it was in a weird thread so you probably didn't find it: http://voxcommando.com/forum/index.php?topic=1034.msg11894#msg11894

Apart from the forum, if you have the XBMC Frodo configuration installed, it's very often a good idea to start by looking at your own command tree for examples that you can build on (e.g. the XBMC Addons group). At least then you can be more confident that you're looking at syntax that works for your set-up.

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Launch Plugins for XBMC
« Reply #3 on: February 08, 2014, 01:20:20 PM »
Just a few notes to add to Kalle's and Nime5ter's excellent info.

If you launch XBMC and it is already running this will focus it so the extra logic is not really necessary in this case, but it is still good to look at Kalle's command since it may come in handy for other programs.

There is a ExecBuiltin command for the xJson plugin but it will only work if you have the VoxTools addon installed because XBMC removed the ExecBuiltin from the API when they switched from the old HTTP APIi to the new JSON based API.  It is preferable to use the JSON command like the one included in the standard VC Frodo config for downloading subtitles, but if you really want to you can use xJson.ExecBuiltin  instead and it should work.
« Last Edit: February 08, 2014, 02:56:23 PM by jitterjames »

Indy

  • $upporter
  • Jr. Member
  • *****
  • Posts: 23
  • Karma: 1
    • View Profile
Re: Launch Plugins for XBMC
« Reply #4 on: February 09, 2014, 05:54:36 PM »
Sorry for taking a while to respond, finally found time to give this a try.

Kalle, Thank you very much for the xml, it works really well during my initial tests.  It looks like it does exactly what I was hoping for, your awesome!

Nime and James, thank you for the information.  I would prefer to use the JSON API since that is what is supported now and my assumption moving forward when Gotham is released for XBMC.  I did get it working thank you very much for the information and is quite easy once you know.  Just never thought to look at download subtitles to find the answer, kind of obscure but does work.

Some caveats I found which I will try and get working with Kalle's example.

If XBMC is not launched, obviously the webserver is not running and can't pass the command to XBMC so that has to happen first.  Maybe you were referring to always launching XBMC with the command and if it running in background it will take focus?.  Also XBMC does launch the addon in the background but XBMC did not take focus.  I will try working on that with Kalle's example to make this as family friendly as possible.  

I would like to take it one step further and call plugins with option.  For example, I would like to say "Watch TV Friends" and it will call the plugin with the options associated to start the stream

plugin://plugin.video.tgun/?url=http%3A%2F%2Fwww.tgun.tv%2Fmenus%2Fplayers%2Fplayerindex4.php%3Ffriends01&play=True&mode=channel

Can this be sent through json?

My wife already thinks I'm crazy talking to the computer, but I keep insisting she needs to watch 2001 or any Star Trek TNG episode to understand what I'm trying to achieve.  Slowly she will get it or divorce me, not sure which one yet.  Wait till she see's my holodeck with a Oculus Rift, Virtuix Omni, and vox commando!  Ok, not close to that yet, but one day.
« Last Edit: February 09, 2014, 05:56:37 PM by Indy »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: Launch Plugins for XBMC
« Reply #5 on: February 09, 2014, 06:46:35 PM »
Haha, nice to hear that it works for you.

Quote
My wife already thinks I'm crazy talking to the computer, but I keep insisting she needs to watch 2001 or any Star Trek TNG episode to understand what I'm trying to achieve.  Slowly she will get it or divorce me, not sure which one yet.  Wait till she see's my holodeck with a Oculus Rift, Virtuix Omni, and vox commando!  Ok, not close to that yet, but one day.

Welcome in the club  :biglaugh
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: Launch Plugins for XBMC
« Reply #6 on: February 09, 2014, 11:43:08 PM »
This command seems to work OK
Put the attached xml in your payloads folder

Code: [Select]
<?xml version="1.0" encoding="utf-16"?>
<commandGroup open="True" name="TGUN" enabled="True" prefix="" priority="0" requiredProcess="" description="">
  <command id="423" name="t gun {1}" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
    <action>
      <cmdType>XJson.Raw</cmdType>
      <cmdString>Player.Open&amp;&amp;"item": { "file": "plugin://plugin.video.tgun/?url=http://www.tgun.tv/menus/players/{1}&amp;play=True&amp;mode=channel"} </cmdString>
      <cmdRepeat>1</cmdRepeat>
    </action>
    <phrase>T Gun</phrase>
    <payloadFromXML phraseOnly="False" use2partPhrase="False" phraseConnector="by" Phrase2wildcard="anyone" optional="False">payloads\tgunchannels.xml</payloadFromXML>
  </command>
</commandGroup>

Indy

  • $upporter
  • Jr. Member
  • *****
  • Posts: 23
  • Karma: 1
    • View Profile
Re: Launch Plugins for XBMC
« Reply #7 on: February 10, 2014, 12:49:05 PM »
Thanks James that is amazing, I will give it a try when I get more time but I assume it will work.  WAF (Wife Acceptance Factor) hopefully will go up a few notches, especially with Friends episodes!