CVideoDatabase: get videos where 'field' is 'value'
#1
This seems like a very basic thing to do, but how do you do it? Without hand coding SQL...

Looking at the JSON-RPC implementation of GetMovies, this is done by creating a smart playlist and encoding into a videodb:// URL. Then in CVideoDatabase it's decoded all the way back again into a smart playlist before the actual "Filter" instance with the query is created.

Surely, there must be an easier way than this do do it?

I've looked at CVideoDbUrl::AddOption, but this only support a small subset of the available fields. I need to support others, like lookup a movie by title.
Reply
#2
CVideoDbUrl::AddOption should be generic and doesn't know anything about the available/possible/supported fields or their values. The problem with having "hardcoded" methods that support all kinds of filtering is that new properties are added all the time and nobody remembers to update those "hardcoded" methods. The URL + smartplaylist approach currently in place was the easiest and least intrusive implementation that would allow access to all properties supported by smartplaylists.

Are you working on something inside or outside of XBMC?
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
#3
Inside. I'm looking into possibilities of implementing something like the json library api in python. To do it like json-rpc you would have build the json object from the python input first to event create a smart playlist. It seems really backwards. And not to mention inefficient. In my unscientific previous test of calling json's GetMovies with filter from python, while the actual query takes 1ms, there's 9ms of overhead.

Several of the methods in CVideoDatabase appears to already accepts Filter input. But I don't see any way of creating them, other than using AppendWhere, but then you are hand coding and hard coding the fields.

The smart playlist already use field enums from the database. I don't see why it would have to be hardcoded any more than what smart playlist does.
Reply

Logout Mark Read Team Forum Stats Members Help
CVideoDatabase: get videos where 'field' is 'value'0