Pulling thumbnails via JSONRPC API
#1
Working on a simple remote app and I'm trying to pull over the thumbnails generated for my videos. If I use the method VideoLibary.GetMovies then it returns a lovely blob of JSON represented videos, and one attribute is the "thumbnail" : "special://masterprofile/Thumbnails/Video/1/1a4eaf33.tbn"

But I'm not sure how to access this image in my application. Is there a method I'm not seeing to somehow send image data over the API? And also, how do I read a .tbn file in the first place (I've read up on it a bit on the Wiki but still not quite sure).

Any help would be greatly appreciated! Thanks.
Reply
#2
jsonrpc have a Files.Download method that will specify depending on the transport layer how you can aquire it. In the current state the only transport layer capable of delievering binary blobs is http and it has a standard way of dealing with it. So you can skip the Files.Download spec since its unused here, just worth mentioning since its by design as some transport may need it, say TCP which might open a new socket just for the data.

Onwards to your question, http has a vfs node which you may use.

http://IP:PORT/vfs/urlencodedpathtodata
So Files.Download should give you vfs/urlencodedpathtodata (if you want to use it, there is no real need for http).

example:
http://localhost:8080/vfs/special://mast...4eaf33.tbn

The .tbn is either a png or a jpeg, there is no real way to know which but most imagelibraries will be able to tell them appart without knowing the extention. At some point we will probably deprecate the .tbn.
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
#3
Perfect! Works great, thanks very much.
Reply
#4
Sounds Great.

I was wondering is there also a API for retreiving thumbnail's location in filesystem by giving the Movie's filename?
e.g. GetThumbnailURL("Cliffhanger (1993).iso"
This requires the XBMC to be running ofcource.

But how could I read the database by PHP and there ask what thumbnails are there for spesific movie?

Reply
#5
Apologies for resurrecting this topic however I'm trying to grab the thumbnail of the currently playing item.
If we assume for now that I'm trying to pull a TV episode thumbnail:

When the item is in the library (provided the thumbnail param is requested) the json Player.GetItem call will give me the thumbnail as a tvdb url.

However when the item is NOT in the library I get the following result:

Code:
{"id":"VideoGetItem","jsonrpc":"2.0","result":{"item":{"fanart":"","file":"nfs://myservers_ipaddress/media/Hitachi4TB/tv/American Horror Story/Season3/American Horror Story - S03E09 - Head.mkv","label":"American Horror Story - S03E09 - Head.mkv","thumbnail":"image://video@nfs%3a%2f%2fmyservers_ipaddress%2fmedia%2fHitachi4TB%2ftv%2fAmerican%20Horror%20Story%2fSeason3%2fAmerican%20Horror%20Story%20-%20S03E09%20-%20Head.mkv/","type":"unknown"}}}

The thumbnail decoded is:
Code:
image://video@nfs://myservers_ipaddress/media/Hitachi4TB/tv/American Horror Story/Season3/American Horror Story - S03E09 - Head.mkv

I don't see how I'm able to get this thumbnail, any ideas?
Reply
#6
The same way you get any art - you request it via the image handler:

http://wiki.xbmc.org/index.php?title=Web...e_.2Fimage

Cheers,
Jonathan
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
Reply
#7
Ciao, I have somewhat similar issue user Habitual, but the URL returned by the JSON-RPC is postfixed with
Code:
/transform?size=thumb


For example this I get the following JSON-RPC response
Code:
{
    "id": "0",
    "jsonrpc": "2.0",
    "result": {
        "item": {
            "file": "/home/pi/_MG_9679-78.jpg",
            "label": "_MG_9679-78.jpg",
            "thumbnail": "image://%2fhome%2fpi%2f_MG_9679-78.jpg/transform?size=thumb",
            "type": "picture"
        }
    }
}

There are two issues:
  • The %2fhome%2fpi%2f prefix is not correctly interpreted, either that I leave it unchanged, I unencode it, or double encode it. The response from the http://xbmc:8080/image/ is always file not found. If I strip away the prefix, then the http get would download the FULL image. E.g.: this works to download the full image: http://xbmc:8080/image/_MG_9569-44.jpg
  • The /transform?size=thumb postfix always generate file not found as a response. Either I leave it as is, or url encoded. For instance this http://xbmc:8080/image/_MG_9569-44.jpg/t...size=thumb does NOT work, unfortunately.

Any idea how can I fix my two issues, please? The first one I don't care much, but be able to have a thumbnail rather then the full download would be helpful.

Thank you very much in advance,
Ciao

(2013-12-23, 03:11)Habitual Wrote: I don't see how I'm able to get this thumbnail, any ideas?
Reply
#8
The above image:// URL is the one that should be passed (URL encoded, ofcourse) to http://xbmc:8080/image/<url_encoded_path>

That's all there is to it. You don't need or want to strip anything from anything. Just URL encode the "thumbnail" attribute and pop it on the end of http://xbmc:8080/image/
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
Reply
#9
jmarshall, i'm struggling with this too. I have a url:

http://htpc/vfs/image://E%3a%5cMusic%5c8...older.jpg/

But i always get file not found. Tried http://htpc/image ... also.

Is there any way I can tell why i'm getting a 404?
Reply
#10
Just read better Smile

You need to URLEncode the image://E%3a%5cMusic%5c808%20State%20-%20Ninety%5cFolder.jpg/ part Smile
(This gives : http://htpc/image/image%3A%2F%2FE%253a%2...der.jpg%2F)

And use /image not /vfs Wink
Reply
#11
Thanks Tolriq. That works!.... I should have posted earlier and saved the hours I've spent trying to get this to work myself.
Reply
#12
I cant get this to work reliably, anyone see what I am doing wrong with these?

http://xbmc_ip:8080/image/image%3A%2F%2F...ter.jpg%2F
This does not work

http://xbmc_ip:8080/vfs/smb%3A%2F%2FNAS%...ter.jpg%2F
This does work (Notice I had to strip the image://)

I also noticed some movies have a http:// address rather than a local image, I was unable to get these images using vfs or image.

Any help would be much appreciated
Reply
#13
By the looks you're missing a double URL encode on the first. i.e. the URL is url_encode(image://url_encode(smb://blah/))

As always, pass in the (url encoded) URL you get from JSON-RPC.
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
Reply
#14
The second one only works because it directly accesses the original artwork on your samba share. But the idea behind image:// URLs is that you access a locally cached version of the artwork which should be faster and also works for HTTP sources etc.
Always read the online manual (wiki), FAQ (wiki) and search the forum before posting.
Do not e-mail Team Kodi members directly asking for support. Read/follow the forum rules (wiki).
Please read the pages on troubleshooting (wiki) and bug reporting (wiki) before reporting issues.
Reply
#15
(2014-03-24, 08:50)jmarshall Wrote: By the looks you're missing a double URL encode on the first. i.e. the URL is url_encode(image://url_encode(smb://blah/))

As always, pass in the (url encoded) URL you get from JSON-RPC.

Thanks you are correct, I had url decoded the artwork url before adding the image:// portion. Its working fine now Smile
Reply

Logout Mark Read Team Forum Stats Members Help
Pulling thumbnails via JSONRPC API0