XBMC-JSON an open source .NET XBMC JSON-RPC Library

  Thread Rating:
  • 1 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
grimstoner Offline
Junior Member
Posts: 9
Joined: Dec 2010
Reputation: 0
Post: #16
Can I make a suggestion?

How about making every object that can be added to a playlist (i.e. Song, Movie, MusicVideo etc.) inherit a common interface/implement a common abstract class? I think at the least that Label is a common field among them all (maybe even a common ID field). That would allow you to do the following :

Code:
CommonPlayListItem pi;

            switch (currentDisplayMode)
            {
               case DisplayMode.AudioPlaying:
                  pi = mainConn.AudioPlaylist.GetCurrentItem();
                  break;

               case DisplayMode.PicturesPlaying:
                  pi = mainConn.PicturePlayer.GetCurrentItem();
                  break;

               case DisplayMode.VideoPlaying:
                  pi = mainConn.VideoPlaylist.GetCurrentItem();
                  break;
            }

            WriteToLCD(pi.Label);

Also... How about adding property changed notifiers? Then your library can also be used in MVVM Silverlight or WPF applications.

PM me so I can contribute.

EDIT: Don't think Mono supports INotifyPropertyChanged, so if you're aim is compatibility, ignore.
(This post was last modified: 2011-01-03 12:46 by grimstoner.)
find quote
grimstoner Offline
Junior Member
Posts: 9
Joined: Dec 2010
Reputation: 0
Post: #17
Also... How about adding a XbmcEventListener class, that opens a TCP port to the XBMC server's port 9090 to listen for notifications generated by XBMC?
find quote
Montellese Offline
Team-XBMC Developer
Posts: 3,488
Joined: Jan 2009
Reputation: 32
Location: Switzerland
Post: #18
grimstoner Wrote:Also... How about adding a XbmcEventListener class, that opens a TCP port to the XBMC server's port 9090 to listen for notifications generated by XBMC?

If you don't need the .NET Micro Framework support you can check out my C# library which provides events derived from notifications: https://sourceforge.net/projects/xbmcjsonsharp/

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: badge.gif]
find quote
dstruktiv Offline
Member
Posts: 66
Joined: Jul 2010
Reputation: 0
Location: New Zealand
Post: #19
grimstoner Wrote:Can I make a suggestion?

How about making every object that can be added to a playlist (i.e. Song, Movie, MusicVideo etc.) inherit a common interface/implement a common abstract class? I think at the least that Label is a common field among them all (maybe even a common ID field).

Cheers for the suggestion, just added abstract XbmcMediaItem class which all other media items inherit from, it contains Id and Label.

Have also started adding Event Listener class. I'm purely working on the async fork as this type of thing just isn't well suited to synchronous I/O. Will commit async fork soon, if you'd like to use the changes in the current sync project you'll have to copy them over sorry.

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.
find quote
dstruktiv Offline
Member
Posts: 66
Joined: Jul 2010
Reputation: 0
Location: New Zealand
Post: #20
Have just committed the async lib @ http://code.google.com/p/xbmc-json/ under trunk/xbmc-json-async

It also has code in there for virtual remote and the event listener (Have only added 3 events so far but adding more is super simple).

There's also a little test client included in the project that shows the basics of using everything asynchronously.

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.
find quote
Tinototem Offline
Junior Member
Posts: 5
Joined: Jan 2011
Reputation: 0
Post: #21
Hello

Am i blind or stupid or maybe both? but i just cant manage to find a download link for the whole solution. I am not really in the mood to download each separate file and then create a own solution.

I got a question regarding the ASYNC project, is it possible to make the XDataReceived generic?

So we don't need to cast our data.
find quote
dstruktiv Offline
Member
Posts: 66
Joined: Jul 2010
Reputation: 0
Location: New Zealand
Post: #22
Tinototem Wrote:Hello

Am i blind or stupid or maybe both? but i just cant manage to find a download link for the whole solution. I am not really in the mood to download each separate file and then create a own solution.

I got a question regarding the ASYNC project, is it possible to make the XDataReceived generic?

So we don't need to cast our data.

There is no solution file for the sync and async projects combined - They're two completely independent projects with different code bases.

There is however a solution file for the async project and the sync project individually under their respective directories so I'm not sure what you mean about downloading individual files and creating a solution?

I've actually struggled to wrap my head around how best to handle the usercallbacks to they don't have to cast the response object, add me on Google talk (tyler@digitalreality.co.nz) so we can talk about it Smile

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.
find quote
grimstoner Offline
Junior Member
Posts: 9
Joined: Dec 2010
Reputation: 0
Post: #23
I can't seem to get the async fx to connect to my XBMC instance...

When using the sample application, the EventListener connects fine, I get event notifications and everything. But the json requests all fail, throwing System.Net.WebExceptions ((404) Not found).

I've turned on all the settings in XBMC (allow control of xbmc via upnp etc.), and I'm sure the username/password combo is correct. Turned off Windows Firewall as well. Anything else I can check?

Which brings me to a suggestion... Is there a way to determine whether the XConnection is connected? Maybe a ping/pong message as soon as you connect?
find quote
grimstoner Offline
Junior Member
Posts: 9
Joined: Dec 2010
Reputation: 0
Post: #24
eh... port 8080 was in use by summing else...
find quote
dstruktiv Offline
Member
Posts: 66
Joined: Jul 2010
Reputation: 0
Location: New Zealand
Post: #25
grimstoner Wrote:Which brings me to a suggestion... Is there a way to determine whether the XConnection is connected? Maybe a ping/pong message as soon as you connect?

Glad you got it sorted, I think I'll add an event to XConnection so you can monitor the connection status Smile

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.
find quote
Tinototem Offline
Junior Member
Posts: 5
Joined: Jan 2011
Reputation: 0
Post: #26
dstruktiv Wrote:There is no solution file for the sync and async projects combined - They're two completely independent projects with different code bases.

There is however a solution file for the async project and the sync project individually under their respective directories so I'm not sure what you mean about downloading individual files and creating a solution?

I've actually struggled to wrap my head around how best to handle the usercallbacks to they don't have to cast the response object, add me on Google talk (tyler@digitalreality.co.nz) so we can talk about it Smile
I am not talking about a solution for async and sync project together, i am trying to download the async project but i only manage to find a download link for each individual file.

Do i need some kind of third part program to link with google code?

Edit: Got it working now.
(This post was last modified: 2011-01-08 20:23 by Tinototem.)
find quote
dstruktiv Offline
Member
Posts: 66
Joined: Jul 2010
Reputation: 0
Location: New Zealand
Post: #27
Tinototem Wrote:I am not talking about a solution for async and sync project together, i am trying to download the async project but i only manage to find a download link for each individual file.

Do i need some kind of third part program to link with google code?

Edit: Got it working now.

It's an SVN repository, I suggest using Tortoise SVN if you're on Windows Smile

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.
(This post was last modified: 2011-01-09 00:43 by dstruktiv.)
find quote
grimstoner Offline
Junior Member
Posts: 9
Joined: Dec 2010
Reputation: 0
Post: #28
Did a bit of work... have a look, lemme know.
find quote
dstruktiv Offline
Member
Posts: 66
Joined: Jul 2010
Reputation: 0
Location: New Zealand
Post: #29
grimstoner Wrote:Did a bit of work... have a look, lemme know.

Looks awesome good stuff Smile

I'm not positive but it looks like you may have missed a few files on your last commit - XSystem, XVideoPlayer etc.

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.
find quote
grimstoner Offline
Junior Member
Posts: 9
Joined: Dec 2010
Reputation: 0
Post: #30
Added them now. Used to TFS, not Subversion...
find quote