A bit different, eh? kodi-nfo-generator

I have been using Kodi as a media center for a very long time, but mostly only browsing directories on a drive (accessed through favorites), not using its capability of meta-data of movies, allowing to browse by genre, actor, etc.

Not necessarily remembering what a movie is about, is some times a bit annoying and the movie meta-data, which can include a plot, would come in rather handy.

What about using a scraper? Well… I tried that once in the past, and it ended in tears: wrong movie data and posters got pulled in – mainly due to me not necessarily having the correct full title and no year in the title. Made things worse, rather than better.

So, in order not to have to create the meta-data myself (aka .nfo files), I just wanted to pull in the data directly from IMDB. And for that, I only needed to the unique IMDB ID and pull the meta-data out of the JSON file embedded in the HTML of the movie page itself.

Python to the rescue and after a bit of proof-of-concept hacking, I was confident to that going. Fast-forward and there is now a little library called kodi-nfo-generator available from my github account. It looks for special files (typically, MOVIE.imdb) in directories which contain the Movie ID. It then pulls in the data and generates the Kodi .nfo XML file with the data obtained from the JSON meta-data (you can also grab the image that IMDB uses). After updating the Kodi library, you now have a fully functional meta-data database. 🙂

Oh, and for the initial setup, I simply compiled a CSV file associating movie ID with the directory of the movie. A tool, which is also part of this library, then processed the CSV file to generate these special files in the correct directories. Using a spreadsheet was much easier than to create all those little files by hand…