Author Topic: xSQL and xJSON how they work?  (Read 3335 times)

0 Members and 1 Guest are viewing this topic.

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
xSQL and xJSON how they work?
« on: May 15, 2013, 04:48:58 AM »
What does xJson do differently when generating an xml compared to xSQL?

I can add another table from any XBMC database to the xSQL generator and it will make the file.
How do i make xJSON do the same thing?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: xSQL and xJSON how they work?
« Reply #1 on: May 15, 2013, 12:08:21 PM »
They do just about everything differently except that they both create payloadXML files that you can use.

If you can use the xSQL plugin then you should because it is better in every way.  Faster, easier to use, and much more powerful.

In some cases though it is not possible, usually this only happens if you are using a mySQL database in XBMC or if your database files are in a location that VoxCommando can't reach for some reason.

xSQL plugin opens the sqlite database files directly and is able to perform sql queries to gather any information contained in the tables.  It does this very efficiently, and lets you create your own sql queries which are powerful and easy to use.  With xSQL, XBMC does not need to be running.

xJSON plugin must talk to XBMC through the http interface and request data using the JSON api, which only exposes certain information and is must clumsier and slow to use.  XBMC must be running.

Here is a reference for the current XBMC JSON api (Frodo):  http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v6

the plugin uses calls such as this ( http://wiki.xbmc.org/index.php?title=JSON-RPC_API/v6#AudioLibrary.GetAlbums ) and then parses the json data returned to create payload XML files:
« Last Edit: May 15, 2013, 12:24:35 PM by jitterjames »

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: xSQL and xJSON how they work?
« Reply #2 on: May 15, 2013, 08:14:55 PM »
I can create XML Payload files from the database with xSQL but it will return different information compared to creating the same XML Payload using xJSON, do you know why this is?

Can I add more commands to the xJSON plugin or is it easier to just run a seperate script to build different Payload XML ?

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: xSQL and xJSON how they work?
« Reply #3 on: May 16, 2013, 08:49:44 AM »
It's kind of difficult to say without more information.

What kind of differences are you talking about specifically?

It would help a lot if you could post both XML files, and if the differences are not obvious, please point them out.  It could be as simple as them being sorted differently, and them looking different even though they contain all the  same data.

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: xSQL and xJSON how they work?
« Reply #4 on: May 16, 2013, 10:48:29 AM »
here's the files:

TvShowTitles.xml from xSQL
Code: [Select]
<payload>
        <value>59</value>
        <phrase>2 Broke Girls</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>58</value>
        <phrase>Alphas</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>57</value>
        <phrase>Anger Management</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>56</value>
        <phrase>Arrow</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>

TvShowTitles.xml from xJSON

Code: [Select]
<payload>
        <value>63</value>
        <phrase>2 Broke Girls</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>64</value>
        <phrase>Alphas</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>65</value>
        <phrase>Anger Management</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>
    <payload>
        <value>66</value>
        <phrase>Arrow</phrase>
        <subsetmatching>true</subsetmatching>
    </payload>

It's got me confused...

jitterjames

  • Administrator
  • Hero Member
  • *****
  • Posts: 7714
  • Karma: 116
    • View Profile
    • VoxCommando
Re: xSQL and xJSON how they work?
« Reply #5 on: May 16, 2013, 11:18:09 AM »
If you are getting different IDs then most likely your xSQL settings are targeting the wrong .db files.  You are either looking in the wrong folder, or you are not using the latest versions of the files (highest number at the end of the file name).  My guess is that this is what is happening.  The default settings in the plugin used the standard filenames for Frodo 1.0 but later versions of Frodo may have incremented the file numbers.
« Last Edit: May 16, 2013, 06:04:23 PM by jitterjames »

Mace

  • $upporter
  • Contributor
  • *****
  • Posts: 77
  • Karma: 1
    • View Profile
Re: xSQL and xJSON how they work?
« Reply #6 on: May 17, 2013, 05:32:02 AM »
well found my mistake.
xSQL was set to one database and xJSON was grabbing data from which ever XBMC it was connected to at the time.

what a noob!

and 2 Broke Girls rocks!, well enough for a half hour entertainment anyway.