JSON-RPC (JSON Remote Procedure Call) interface protocol in development for XBMC

  Thread Rating:
  • 7 Votes - 5 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
Montellese Online
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2061
(2012-07-04 19:23)Mizaki Wrote:  When you have a spare minute I'm still getting a segfault with pre-frodo.
Code:
{"jsonrpc": "2.0", "method": "VideoLibrary.GetMovies", "params": { "limits": { "start" : 303, "end": 349 }, "properties" : ["rating", "thumbnail", "playcount", "file"], "sort": { "order": "ascending", "method": "label", "ignorearticle": true } }, "id": 1}
If "start" is <303 it seems to work. I ran gdb and crashed it. I have no idea with gdb so this may be no help whatsoever.
Code:
std::_Rb_tree<Field, std::pair<Field const, CVariant>, std::_Select1st<std::pair<Field const, CVariant> >, std::less<Field>, std::allocator<std::pair<Field const, CVariant> > >::_M_erase (this=0xad1f7e8, __x=0x1)
    at /usr/include/c++/4.6/bits/stl_tree.h:1064
1064              _M_erase(_S_right(__x));
http://pastebin.com/KRiYz30A

Anything else I can do to try and find the problem?

Fixed in https://github.com/xbmc/xbmc/commit/76b1...6f009eb234

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
Mizaki Offline
Fan
Posts: 662
Joined: Apr 2011
Reputation: 12
Post: #2062
That's great, thanks.

[Image: watched-clearlogo.jpg]
AWXi - Ajax web interface. Wiki
find quote
Tolriq Offline
Member+
Posts: 1,832
Joined: Jun 2009
Reputation: 52
Location: France
Post: #2063
(2012-06-04 16:55)Montellese Wrote:  Yes after Eden jmarshall has changed the way XBMC caches images. They are now referenced with an URI of the following schema:
Code:
image://<url encoded uri from where the image originally came>
and that's also what you should get through JSON-RPC. You should still be able to URL-encode the whole image URI you get through JSON-RPC and call http://<ip>:<port>/vfs/<url encoded image path> but you should switch to using http://<ip>:<port>/image/<url encoded image path> which (in the future) will provide additional functionality like automatic image resizing during retrieval etc. So basically nothing has changed, the returned URIs just look different.

I'm trying the yesterday alpha and it seems there's some speed problems.
This request on same numbers of movies ( Request : {"id":1,"jsonrpc":"2.0","method":"VideoLibrary.GetMovies","params":{"properties":["director","genre","plot","rating","runtime","sorttitle","studio","thumbnail","title","trailer","playcount","year"]}}) takes like 1 sec more (around 1000 movies)

And the very most annoying part the image download are slowwwwwwwwwwwwwwwwww (i still use the /vfs).
Image takes like 10 time more times to download on android perhaps more.

I use optimizations that should only download the file header then download the file in an optimised way for target small resolution
Don't really know what it does with webserver but worked perfect before Frodo.

The used code : (Image size is 240 for my batch downloads of thumbs).

Code:
private Bitmap downloadImage(ImageInfo image, int ImageSize) {
        Bitmap b = null;
        try {

            InputStream is;
            int scale = 1;
            // Decode image size
            if (ImageSize > 0) {
                BitmapFactory.Options o = new BitmapFactory.Options();
                o.inJustDecodeBounds = true;

                is = getImageStream(image, NETWORK_TIMEOUT);
                BitmapFactory.decodeStream(is, null, o);
                is.close();
                is = null;
                if (o.outHeight > ImageSize || o.outWidth > ImageSize) {
                    scale = (int) Math.pow(
                            2,
                            (int) Math.round(Math.log(ImageSize
                                    / (double) Math.max(o.outHeight, o.outWidth))
                                    / Math.log(0.5)));
                }

            }
            // Decode with inSampleSize
            BitmapFactory.Options o2 = new BitmapFactory.Options();
            if (ImageSize > 0) {
                o2.inSampleSize = scale;
            }
            o2.inJustDecodeBounds = false;
            o2.inDither = true;
            o2.inScaled = false;
            o2.inPreferredConfig = Bitmap.Config.RGB_565;
            is = getImageStream(image, NETWORK_TIMEOUT);
            b = BitmapFactory.decodeStream(is, null, o2);
            is.close();
            is = null;
        } catch (Exception e) {
            if (Logger.LOG_WARN)
                Logger.LogWarning(TAG, "Exception : " + e.getMessage());
        }
        return b;
    }

Yatse 2 : Media Center Remote Control for Touch Screens
Yatse, the Xbmc Remote and Widgets for Android
find quote
Millencolin007 Offline
Senior Member
Posts: 214
Joined: Mar 2012
Reputation: 7
Location: Switzerland
Post: #2064
I am using a similar piece of code to download images. The code is actually still downloading the whole file but uses less memory on the android device to decode the file into a bitmap.

And since some images are sent in 1920x1080 it is slow to fetch the files.
find quote
Tolriq Offline
Member+
Posts: 1,832
Joined: Jun 2009
Reputation: 52
Location: France
Post: #2065
Well the problem is :
Same Android code / same database same images (I use multi threaded limited to 2 thread on my SIII for tests).
- Eden : image are correctly downloaded 2 by 2 more than 10 images in 1 sec.
- Frodo : image seems to have troubles being downloaded 2 by 2 and it's more 1,5 sec / image

And I repeat same code same database same images Sad

Edit : And of course same phone same computer 2 install in portable mode

Yatse 2 : Media Center Remote Control for Touch Screens
Yatse, the Xbmc Remote and Widgets for Android
(This post was last modified: 2012-07-09 23:30 by Tolriq.)
find quote
Tolriq Offline
Member+
Posts: 1,832
Joined: Jun 2009
Reputation: 52
Location: France
Post: #2066
Ok got it Smile

Using /vfs or /image is clearly not the same Smile
I should have figured out earlier but did not focus on correct things for tests

But using /vfs will get the original file that can be a 3MB full sized png from source (Can be a web server or a slow NAS).
(BTW using /vfs/image:// does not work so I stupidely removed the image:// part)
Using /image will get the cached image that is correctly resized by xbmc and local to xbmc.

That explain the very big speed difference, should be clearly stated for people that will port from Eden to Froyo Smile

Yatse 2 : Media Center Remote Control for Touch Screens
Yatse, the Xbmc Remote and Widgets for Android
find quote
jmarshall Offline
Team-XBMC Developer
Posts: 24,523
Joined: Oct 2003
Reputation: 138
Post: #2067
Requesting thumbnail is an extra query per movie, so that will be slow.

For the image download, my guess (and it's just a guess) is that the images you have in your texture cache are much larger than they were in Eden - reason is that there was a period of about 2-3 months where they were cached at fullsize. If that's the case, then you have to transfer much more data across the network to do the resize. Latest master (i.e. after the music thumbs were slotted in) will cache art at a lower resolution, so this should speed things up (they'll be cached at around 1/4 the size as before).

Oh, and if using vfs (which you shouldn't in frodo, ofcourse!) the image:// URL you pass in has to be URL encoded, else it won't work.

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]
(This post was last modified: 2012-07-10 00:10 by jmarshall.)
find quote
Tolriq Offline
Member+
Posts: 1,832
Joined: Jun 2009
Reputation: 52
Location: France
Post: #2068
See my last post Smile

The problem was more a problem about /vfs and not a problem with /image that works ok.

Edit :
- Why is the thumb send from JSON already urlencoded ? this lead to have the url encoded twice ?

Yatse 2 : Media Center Remote Control for Touch Screens
Yatse, the Xbmc Remote and Widgets for Android
(This post was last modified: 2012-07-10 00:29 by Tolriq.)
find quote
mikebzh44 Offline
Posting Freak
Posts: 1,057
Joined: Nov 2011
Reputation: 18
Location: Nantes - France
Post: #2069
Is there a way to get last added favourites with JSON RPC ?

Thanks.

EDIT : I think it's not possible the way some users use favourites :

http://forum.xbmc.org/showthread.php?tid...pid1144455

Sorry for my english, but, you know, I'm French so ...

(This post was last modified: 2012-07-10 14:09 by mikebzh44.)
find quote
Montellese Online
Team-XBMC Developer
Posts: 2,789
Joined: Jan 2009
Reputation: 20
Location: Switzerland
Post: #2070
(2012-07-10 00:12)Tolriq Wrote:  Edit :
- Why is the thumb send from JSON already urlencoded ? this lead to have the url encoded twice ?
Because otherwise it's not a valid URL. The way it is now you can take whatever JSON-RPC provides you for thumbs/fanart and directly pass it to the /image handler of XBMC's webserver.

(2012-07-10 12:02)mikebzh44 Wrote:  Is there a way to get last added favourites with JSON RPC ?

Thanks.

EDIT : I think it's not possible the way some users use favourites :

http://forum.xbmc.org/showthread.php?tid...pid1144455
No there is no support for accessing favourites (unless it's somehow possible over the VFS and therefore through JSON-RPC's Files.GetDirectory).

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
Post Reply