Home > Linux, Programming, Windows > Dirty script to import videos into XBMC Library

Dirty script to import videos into XBMC Library

I use XBMC as my media center solution at home as described in the old post XBMC Linux media center.


  • With a terabyte plus of videos, I needed a solution where I could easily track which videos I have watched, and easily resume from where I stopped watching.
  • The comfort of easily navigating the media center using a wireless keyboard
  • XBMC works!

Though you can easily navigate the video folders, I needed to add the videos to the library so I can enjoy the extra features provided by XBMC library section.

I tried modifying properties of the video folders to set content type to movies such that XBMC automatically adds it to the library, but that doesn’t seem to work because:-

My video files are not named according to the IMDB naming scheme i.e they can’t be scrapped from IMDB while being added to the library. Also my folder structure isn’t organized according to the recommended standards. Lastly, currently I don’t have an internet connection home, since its needed to connect to IMDB.

With the above reasons I resorted to having to write a script to add the movies to the movie database of XBMC.
XBMC uses sqlite for its movie database. Python would be the simplest to use. Am not very good with python, but am mostly able to use it to archive whatever automated task I need.

Basically what the script does, is to find videos matching a  pattern ( *.avi *.iso *.mkv *.vob *.mp4 *.rmvb *.mpg *.dat *.wmv ) and add them to the Sqlite database. It chooses the movie category based on the folder it finds the movie. I structured it to work according to the way I organize my videos. Its not the best solution, but it works, atleast for me.

Script can be got  http://dl.dropbox.com/u/3158042/databaseMovieImport.py

Categories: Linux, Programming, Windows
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: