Kodi Community Forum
Pulling thumbnails via JSONRPC API - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Kodi Application (https://forum.kodi.tv/forumdisplay.php?fid=93)
+--- Thread: Pulling thumbnails via JSONRPC API (/showthread.php?tid=74938)

Pages: 1 2


Pulling thumbnails via JSONRPC API - jbrennan - 2010-06-01

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.


- topfs2 - 2010-06-01

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://masterprofile/Thumbnails/Video/1/1a4eaf33.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.


- jbrennan - 2010-06-03

Perfect! Works great, thanks very much.


RE: Pulling thumbnails via JSONRPC API - realjobe - 2012-11-16

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?




RE: Pulling thumbnails via JSONRPC API - Habitual - 2013-12-23

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?


RE: Pulling thumbnails via JSONRPC API - jmarshall - 2013-12-23

The same way you get any art - you request it via the image handler:

http://wiki.xbmc.org/index.php?title=Webserver#Image_cache_.2Fimage

Cheers,
Jonathan


RE: Pulling thumbnails via JSONRPC API - tari-manga - 2014-02-10

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:
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?



RE: Pulling thumbnails via JSONRPC API - jmarshall - 2014-02-11

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/


RE: Pulling thumbnails via JSONRPC API - sparer - 2014-02-13

jmarshall, i'm struggling with this too. I have a url:

http://htpc/vfs/image://E%3a%5cMusic%5c808%20State%20-%20Ninety%5cFolder.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?


RE: Pulling thumbnails via JSONRPC API - Tolriq - 2014-02-13

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%255cMusic%255c808%2520State%2520-%2520Ninety%255cFolder.jpg%2F)

And use /image not /vfs Wink


RE: Pulling thumbnails via JSONRPC API - sparer - 2014-02-13

Thanks Tolriq. That works!.... I should have posted earlier and saved the hours I've spent trying to get this to work myself.


RE: Pulling thumbnails via JSONRPC API - pbsask - 2014-03-24

I cant get this to work reliably, anyone see what I am doing wrong with these?

http://xbmc_ip:8080/image/image%3A%2F%2Fsmb%3A%2F%2FNAS%2FMovies%2FThe%20Hobbit%2FThe.Hobbit-poster.jpg%2F
This does not work

http://xbmc_ip:8080/vfs/smb%3A%2F%2FNAS%2FMovies%2FThe%20Hobbit%2FThe.Hobbit-poster.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


RE: Pulling thumbnails via JSONRPC API - jmarshall - 2014-03-24

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.


RE: Pulling thumbnails via JSONRPC API - Montellese - 2014-03-24

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.


RE: Pulling thumbnails via JSONRPC API - pbsask - 2014-03-25

(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