Kodi Community Forum

Full Version: wrong duration returned by VideoLibrary.GetMovies
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I'm not sure wheter this is a proper bug or just "unexpected behaviour", so I post here first before opening a bug report.

I think I found a inconsistency with the calls to VideoLibrary.GetMovieDetails and VideoLibrary.GetMovies, as both return different duration times of some movies (I guess those that have different length than what the scraper inserted into the database). Both functions call the corresponding functions in xbmc/interfaces/json-rpc/VideoLibrary.cpp, which both do different calls to get all the infos wanted. I don't even know where GetMovieDetails gets it data from, because I could not find the returned runtimes in the database. I think it might actually get some stream infos.

Just for clarity, the durations returned by GetMovieDetails seem to be the correct ones.
Yeah this is possible because GetMovieDetails automatically gets the stream details and extracts the runtime from it. If you'd rescan your files xbmc should store the runtime from the stream details in the movie table. But this has only been added with Gotham IIRC.
Then why doesn't it do so in the first place? It obviously should.
You mean always retrieve the stream details and extract the runtime from it? Because it will require additional database queries and if VideoLibrary.GetMovies returns 1000 movies the number of SQL queries jumps from 1 to 1 + 1000 * 2 = 2001 which makes things a lot slower (depending on the number of movies in the range of several seconds). If you want to get this behaviour you can try to specify in your request that you want to get the "streamdetails" property when calling VideoLibrary.GetMovies and see if that solves the problem.
No, I meant why isn't the right time stored in the movie table? Doesn't that mean there's something wrong with the scrapers? Any scraper should use the stream details of the actual file when inserting the data into the table, not some data it gets from some arbitrary source.
The scraper doesn't have access to the file itself. It can only retrieve data from some websites and rely on that information. So if you use the IMDB scraper it goes to IMDB and retrieves the runtime but since there are a ton of different releases and versions you usually end up with wrong information. That's why XBMC (not the scraper) now contains some logic to retrieve the runtime from the streamdetails if a new item is added to the library. But that logic only applies to re-scanned and newly added items not the ones that are already in your library. I'm not sure when that logic was added but it hasn't been there for long.
Ok, that sound sane. Nonetheless it might be nice to have some interface for scrapers to get the stream details, might even help them collecting the data needed and retrieving better results, and also help with putting more correct data to the tables.

As this is not the case yet, but I still would love to have the correct data in my tables - so how do I re-scan properly, with the least possible effort?