Author Topic: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012  (Read 28621 times)

0 Members and 4 Guests are viewing this topic.

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« on: October 21, 2012, 12:52:30 PM »
Here I will post the latest updates, scripts, and plugins in an effort to make the switch from the http api to the new JSON api.

In order to test you will need to update to the latest version of XBMC found here: http://mirrors.xbmc.org/nightlies/

Because the JSON interface is missing a lot of the functionality that we normally use we will need to do the following, which means that setup will be a bit more complicated, but hopefully the end functionality will be at least as good as it was.

1) Install an addon in XBMC called voxtools.  This is easily done, I will provide a .zip file and you will only need to do an "install from .zip".  using this addon we can do things like "xbmc.execbuiltin" which is not possible with JSON
2) Rely more on Smart Playlists - because the JSON library does not allow us to do very sophisticated playlist building, at least, not that I have been able to figure out.
3) GenXML will now require a new VC plugin that can access the XBMC database files directly in order to do SQL queries which are not available in the JSON api
4) use a new VC plugin for JSON commands.  This way people using EDEN can use the original XBMC actions in VC and people using pre-Frodo can use the plugin actions.


I will be looking for people to help me figure out specific problems.  I can manage by myself but if I get help it will go faster.

I will also need people to help me test these crazy new ideas / workarounds.  Testing means installing the lastest version of XBMC which will no longer support the old methods, so you will need to have a spare system set up if you want to continue to use the old configurations of VC with XBMC :(

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #1 on: October 21, 2012, 12:52:46 PM »
reserved

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #2 on: October 21, 2012, 12:52:51 PM »
reserved

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #3 on: October 21, 2012, 12:52:56 PM »
reserved

fishware

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 1
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #4 on: January 05, 2013, 04:02:21 PM »
Hi outhere,

I will short introduce myself (sorry for my english, I'm a german native)

I'm from Berlin in Germany, 37 years old and "play around" with computer, multimedia, and voicecontrol!!! since around 1995.
At this time the computer can't play videos  ;) and also he don't hear me (IBM ViaVoice, what a ****).

Now serevals years later I use XBMC to consume HighDefinition Videos over GBLan, controlled from a remotedevice in my pocket (greetings from Android).
One step closer to  the "Star Trek Bridge"

And a few days ago, I discovred VoxCommando!!!

I try outit  with an wireless Headset from Asus and a Windows7 OS....it works perfect!!!

Very nice job James


I will be looking for people to help me figure out specific problems.  I can manage by myself but if I get help it will go faster.

I will also need people to help me test these crazy new ideas / workarounds.  Testing means installing the lastest version of XBMC which will no longer support the old methods, so you will need to have a spare system set up if you want to continue to use the old configurations of VC with XBMC :(

I play around with the XJson plugin.
So, I will help to improve this features, because I think it is a really nice one.

I stay tuned.........

Chris



jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #5 on: January 05, 2013, 04:35:19 PM »
Welcome aboard fishware.  You are most welcome.

I am actually working on a new release of the xJson plugin and some commands that work with it.

I hope to have some good stuff ready for people to play with by the end of January and I will be very happy to have people to help test.  I'm sure Kalle will be happy to have someone help with the German version of the commands.

I was doing some testing with RC2 (just updated to RC3 today) and found it was still quite unstable.  Is it just me?  RC2 was crashing every time I closed it, and would often crash when listening to music and then pressing "stop".  Also, some commands I was testing would work fine for a while, and then just stop working.

I think we may still have a long way to go before we have a fully functional VoxCommando / Frodo solution, but I have most stuff working now, most of the time. :)

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #6 on: January 05, 2013, 05:15:57 PM »
Hi Chris und willkommen im VoxCommando forum  ::wave

und da Du es gerade erwähnst
Quote
Now serevals years later I use XBMC to consume HighDefinition Videos over GBLan, controlled from a remotedevice in my pocket (greetings from Android).
One step closer to  the "Star Trek Bridge"

hier ein kleiner Einblick was mit VC so alles machbar ist  ;)

http://www.youtube.com/watch?v=7JyM7bLgADU

@James - At the moment I doesn't use frodo, I'll be waiting to march to take a look on it  ::yikes  (NANO is in my baggage)

Kalle
***********  get excited and make things  **********

fishware

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 1
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #7 on: January 05, 2013, 07:02:44 PM »
Quote
I will also need people to help me test these crazy new ideas / workarounds.

Long time i'v been looking for a solution to view my tvshows sometimes in german sometimes in english for while.
All tvshows has as first audiotrack the german language and english as the second. All players incl. XBMC plays after mediachange the first track, so I have to set it to second track manually every time.  >:(
Now i found a solution with  :clap VOXCOMMANDO !!!

<?xml version="1.0" encoding="utf-16"?>
<command id="465" name="AudioStreamChange" enabled="true" alwaysOn="False" confirm="False" requiredConfidence="0" loop="False" loopDelay="0" loopMax="0" description="">
  <action>
    <cmdType>XJson.Raw</cmdType>
    <cmdString>Player.SetAudioStream&amp;&amp;"playerid":1,"stream":"next"</cmdString>
    <cmdRepeat>1</cmdRepeat>
  </action>
  <event>Player.OnPlay</event>
</command>

This runs in the backround. Next step is to set up XBMC to play german or english via voicecommando until it is change via voicecommando

kind regards

chris

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #8 on: January 05, 2013, 08:52:21 PM »
Fast learner! :o  I can see you are going to be trouble ;)

The good kind of trouble though.

Quote
This runs in the backround. Next step is to set up XBMC to play german or english via voicecommando until it is change via voicecommando

I'm not sure I understand what you are saying here.  Can you explain more?

fishware

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 1
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #9 on: January 05, 2013, 09:42:13 PM »
Quote
Fast learner! Shocked  I can see you are going to be trouble Wink

Thanks for that.

Often if I at home it runs a TVshow in the background, Episode for Episode (so it is a little trouble at home  ;) )
Most of tvshows i've had, are with two audiotracks in an avicontainer. First track is mostly german, second track is the origin mostly english.
To advanced my english skills, I run the tvshows sometimes only in english episode for episode.

Now the Problem:

After every episode change all mediaplayers that I tried, incl. XBMC switch to the first audiotrack of an avi, in my case mostly german.
Now I must change the audiotrack manually each time.
With voxcommando it is possible to trigger the episode is changed. Than voxcommando send a JSon statement to change the audiotrack.
So I can choose to hear/watch the episodes all in english (if the trigger is on) or in german without the trigger, e.g. shutdown voxcommander.

Next step should be, that voxcommander 'knows' which language i want to hear, and switch the audiotrack after each change automaticly or not.
This to option should be switch via voice commando, and so I looking at the moment to set variables in voxcommand.


I hope I can clear your mind. Sorry for my english, but I trained every day.... ;)

kind regards

chris
 

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #10 on: January 05, 2013, 10:21:11 PM »
OK. No problem.  VoxCommando can store a variable which you can set with a voice command.

When a new video begins to play VC can check the variable with a logic block (if then else).

I am away from my computer until tomorrow night , but if you still need help then, I can assist you.

You can either store the variable in memory (VC will forget when you shut it down) or you can write the variable to a text file.  Kalle has an example on the forum where he does this to remember which lights are on or off.

fishware

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 1
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #11 on: January 05, 2013, 10:57:28 PM »
Really cool your program.
Easy to learn I think.

One question:

Is there a way to set two IF conditions?

One condition is the playstate of XBMC (paused or not) -> this state I set to a variable 'pause' [on|off]
Second condition is wich language is set, and is it nessesary to switch the audiostream.

Code: [Select]
IF "pause" == off AND IF "lang" == eng
THEN {
           XJson.Raw Player.SetAudioStream "playerid":1,"stream":"next"
         {
ELSE {
          Do nothing
         }


Here is an example, how could it works....

« Last Edit: January 06, 2013, 02:32:36 AM by fishware »

Kalle

  • $upporter
  • Hero Member
  • *****
  • Posts: 2320
  • Karma: 47
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #12 on: January 06, 2013, 04:58:57 AM »
Really cool your program.
Easy to learn I think.

One question:

Is there a way to set two IF conditions?

One condition is the playstate of XBMC (paused or not) -> this state I set to a variable 'pause' [on|off]
Second condition is wich language is set, and is it nessesary to switch the audiostream.

Code: [Select]
IF "pause" == off AND IF "lang" == eng
THEN {
           XJson.Raw Player.SetAudioStream "playerid":1,"stream":"next"
         {
ELSE {
          Do nothing
         }


Here is an example, how could it works....


Ich denke es ist möglich, indem Du den "play status" und "lang status" von XBMC in eine Datei speicherst und in deinem Befehl an erster Stelle abfragst.
Schau Dir im Editor unter "file" die actions "writeline" und "readline" an.
Bin Heute unterwegs, aber wenn ich es schaffe gebe ich Dir ein Beispiel.
***********  get excited and make things  **********

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #13 on: January 06, 2013, 08:38:51 AM »
It is not possible to do a compound if statement.  The logic blocks are admittedly, very simple, but they work for the majority of cases.

To get around this we can we can use two if blocks next to eat h other, and if the first condition is not met we call an action to abort execution of the command.

http://voxcommando.com/mediawiki/index.php?title=Actions#StopMacro

fishware

  • Jr. Member
  • **
  • Posts: 44
  • Karma: 1
    • View Profile
Re: XBMC JSON: for pre-Frodo nightlies after Oct. 9th 2012
« Reply #14 on: January 09, 2013, 06:56:26 AM »
Quote
http://voxcommando.com/mediawiki/index.php?title=Actions#StopMacro

Thx. I still need more time to discover the "whole universe" that can my voice control......  ;)

I have found another possible solution. With the

Code: [Select]
{"jsonrpc":"2.0","method":"Player.GetProperties","params":{"playerid":1,"properties":["currentaudiostream"]},"id":1}
I get

Code: [Select]
{"id":1,"jsonrpc":"2.0","result":{"currentaudiostream":{"bitrate":115575,"channels":2,"codec":"mp3","index":1,"language":"","name":"Stereo"}}}
I try this with a telnetsession

Now, I want to use this in VC with the XJson.Raw and the XJson.ParseTokens.

I use it this way

Quote
<action>
                <cmdType>XJson.Raw</cmdType>
                <cmdString>Player.GetProperties&amp;&amp;"playerid":1,"properties":["currentaudiostream"]</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>XJson.ParseTokens</cmdType>
                <cmdString>{item.currentaudiostream[]}</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>
            <action>
                <cmdType>OSD.ShowText</cmdType>
                <cmdString>{item.currentaudiostream}&amp;&amp;5000</cmdString>
                <cmdRepeat>1</cmdRepeat>
            </action>

And this is from the vox.Log.txt

Quote
Action:  XJson.Raw - Player.GetProperties&&"playerid":1,"properties":["currentaudiostream"]
09.01.2013 10:48:17   343   action repeat set to: 1

this is from jsonlog.txt

Quote
456   Error while calling JSON RPC:{"jsonrpc": "2.0", "method": "Player.GetProperties", "params":{"playerid":1,"properties":["currentaudiostream"]},"id": "0"}
System.Net.WebException: Der Server hat eine Protokollverletzung ausgeführt.. Section=ResponseStatusLine
   bei System.Net.HttpWebRequest.GetResponse()
   bei vcPlugin.xjComm.PostRequest(String strRequest)

Attached is a screenshot from voxcommando with errormessage

I hope it is not bug in the proggi but rather to me  ;)

chris