XBMC-JSON an open source .NET XBMC JSON-RPC Library
#1
Thumbs Up 
Hi All, just letting any interested devs know I've made a .Net library for interfacing with XBMC's JSON API.

Both Sync and Async projects are available although no one is currently maintaining the Sync project as this type of network I/O is far better suited to Asynchronous operations.

We currently have a few committers actively working on the project and it should be considered stable and ready for use.

Source and binaries available at http://code.google.com/p/xbmc-json/

If anyone would like to join the project let me know Smile

Cheers.
XBMC Remote7 an XBMC library browser/remote for Windows Phone 7.
Xbmc-Json a .NET XBMC JSON API Library.
Xbmc-Remote-Control a .NET based XBMC library browser and remote for Windows, Linux and OS X.
Reply
#2
Looks good Smile

You should perhaps, set a target c# version in VS to C# 2.0 so the code have more chance to be mono compatible (and so do not use default value parameters for example ).

And perhaps add a little more value, by removing the need to handle Json in the client, you library can do the work to move things to collection/lists and string, int , ... to remove all the tasks that all users of your lib will need to do Smile

Tolriq.
Reply
#3
Tolriq Wrote:Looks good Smile

You should perhaps, set a target c# version in VS to C# 2.0 so the code have more chance to be mono compatible (and so do not use default value parameters for example ).

And perhaps add a little more value, by removing the need to handle Json in the client, you library can do the work to move things to collection/lists and string, int , ... to remove all the tasks that all users of your lib will need to do Smile

Tolriq.

Thanks Smile

I'll look at adding method overloads instead of optional parameters later I'm too lazy to type it all out at the moment and there's much funner stuff to work on Big Grin

Good idea about making the library handle the json... I started to update it... It does all the work now Smile

Code:
using System;
using System.Collections.Generic;
using XbmcJson;

namespace XBMCJsonTest
{
    class Program
    {
        static void Main(string[] args)
        {
            XbmcConnection xbmc = new XbmcConnection("192.168.1.200", 80, "xbmc", "");

            if (xbmc.Status.IsConnected)
            {
                foreach (TvShow e in xbmc.VideoLibrary.GetTvShows())
                {
                    Console.WriteLine(e.label);
                    Console.WriteLine(e.file);
                    Console.WriteLine(e.thumbnail);
                    Console.WriteLine(e.id);
                    Console.WriteLine();
                }
            }
            else
            {
                Console.WriteLine("Unable to connect to XBMC");
            }

            Console.ReadLine();
        }
    }
}
XBMC Remote7 an XBMC library browser/remote for Windows Phone 7.
Xbmc-Json a .NET XBMC JSON API Library.
Xbmc-Remote-Control a .NET based XBMC library browser and remote for Windows, Linux and OS X.
Reply
#4
Added classes for each media type and updated all functions to return either generic types or instances of media classes. No more need to parse the JsonObjects in your own code Smile

Code:
using System;
using System.Collections.Generic;
using XbmcJson;

namespace xbmc_jsonTest
{
    class Program
    {
        static void Main(string[] args)
        {
            XbmcConnection xbmc = new XbmcConnection("127.0.0.1", 80, "xbmc", "password");

            if (xbmc.Status.IsConnected)
            {
                foreach (Movie m in xbmc.VideoLibrary.GetMovies(start: 1, end: 2))
                {
                    Console.WriteLine("id: " + m._id);
                    Console.WriteLine("file: " + m.File);
                    Console.WriteLine("label: " + m.Label);
                    Console.WriteLine("thumbnail: " + m.Thumbnail);
                    Console.WriteLine("director: " + m.Director);
                    Console.WriteLine("writer: " + m.Writer);
                    Console.WriteLine("studio: " + m.Studio);
                    Console.WriteLine("genre: " + m.Genre);
                    Console.WriteLine("year: " + m.Year);
                    Console.WriteLine("runtime: " + m.Runtime);
                    Console.WriteLine("rating: " + m.Rating);
                    Console.WriteLine("tagline: " + m.Tagline);
                    Console.WriteLine("plotoutline: " + m.PlotOutline);
                    Console.WriteLine("plot: " + m.Plot);
                }
            }
            else
            {
                Console.WriteLine("Unable to connect to XBMC");
            }

            Console.ReadLine();
        }
    }
}
XBMC Remote7 an XBMC library browser/remote for Windows Phone 7.
Xbmc-Json a .NET XBMC JSON API Library.
Xbmc-Remote-Control a .NET based XBMC library browser and remote for Windows, Linux and OS X.
Reply
#5
I've made a seperate branch that uses the Newtonsoft library too communicate; which has a .NET compact version so WinMo developers get some of the candy too Smile Still heavily under development though, just like the main branch.

enjoy Laugh
Reply
#6
Just committed latest version which pretty much has all functions currently implemented in xbmc. Went through and removed .Net 4.0 optional parameters and added method overloads. Have changed .Net version to 3.5 so should hopefully be Mono compatible now if anyone wants to try...
XBMC Remote7 an XBMC library browser/remote for Windows Phone 7.
Xbmc-Json a .NET XBMC JSON API Library.
Xbmc-Remote-Control a .NET based XBMC library browser and remote for Windows, Linux and OS X.
Reply
#7
First app making use of this lib going up - If anyones interested in contributing PM me:

http://code.google.com/p/xbmc-remote-control/

Image
XBMC Remote7 an XBMC library browser/remote for Windows Phone 7.
Xbmc-Json a .NET XBMC JSON API Library.
Xbmc-Remote-Control a .NET based XBMC library browser and remote for Windows, Linux and OS X.
Reply
#8
Awesome, plain awesome!.

Love to see how quick you guys are able to create stuff with jsonrpc.

Keep up the good work!

Cheers,
Tobias
If you have problems please read this before posting

Always read the XBMC online-manual, FAQ and search the forum before posting.
Do not e-mail XBMC-Team members directly asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting please make sure you read this first.

Image

"Well Im gonna download the code and look at it a bit but I'm certainly not a really good C/C++ programer but I'd help as much as I can, I mostly write in C#."
Reply
#9
Thanks topfs2 we've spent heaps of time getting the lib up to scratch Smile

Latest screenshot of remote:

Image
XBMC Remote7 an XBMC library browser/remote for Windows Phone 7.
Xbmc-Json a .NET XBMC JSON API Library.
Xbmc-Remote-Control a .NET based XBMC library browser and remote for Windows, Linux and OS X.
Reply
#10
this is really excellent. It is going to make my life so much easier. Thanks for creating this! Keep up the good work.
Image
VoxCommando.com
Reply
#11
dstruktiv Wrote:If anyone would like to join the project let me know Smile

I implemented System.GetInfoLabels function.
Do you want me to send a patch?
Reply
#12
If anyone's interested, i'm currently rewriting the library to work entirely asynchronous. Hope to get it done in a couple of days.
Reply
#13
Many heartfelt thanks guys.. With all the time and effort you put into these developments, I can't say thank you enough.

Cheers!
Reply
#14
Keep up the good work, i'm using it in some of my home automation projects Wink
Reply
#15
Btw there is a bug in the GetRecentlyAddedEpisodes method:

Code:
if (query["movies"] != null)
{
       foreach (JObject item in (JArray)query["movies"])
       {

Change to

Code:
if (query["episodes"] != null)
{
       foreach (JObject item in (JArray)query["episodes"])
       {
Reply

Logout Mark Read Team Forum Stats Members Help
XBMC-JSON an open source .NET XBMC JSON-RPC Library1