xbmc/xbmc — pull request #958 by jmarshallnz (2012-05-12 08:36:48+00:00)
Title: Image VFS support for JSON-RPC

This adds support for trivial image:// wrapped URLs suitable for JSON-RPC use.

In CFile::Open() we check whether the texturecache has the image, and cache if not. Then we fall through to the cached version of the image.

This allows us to set image:// URLs in JSON-RPC, so that images are cached only if they're actually fetched by the client, not just if they request items that may have art that is not cached. Currently clients retrieve art via the VFS, so setting an image:// URL allows backward compatibility until such a time as JSON-RPC supports a direct image retrieval handler, whereby that handler can just use the VFS internally.

A couple of things to discuss:

1. Currently for JSON-RPC we set only art that has been previously discovered (i.e. is in the database). Eden users updating to nightlies will therefore need to view the images in XBMC before they'll be available over JSON-RPC. We could change this by running the backward compatibility code via the thumbloader, however this is very slow for large numbers of items being retrieved.

2. I've currently not fully implemented CFile::Stat() - in particular Stat() will fail if the image has not yet been cached. IMO this isn't an issue as it's unlikely that we'll be calling this. I could fall through to Stat() on the original image, but this ofcourse will give inaccurate information (size for example).

I consider this a fix rather than a feature (currently no art is available for video items via JSON-RPC).