Raspberry Pi, Kodi Media Center & Ubuntu

One of the jobs I am using my Raspberry Pi for (or rather: one of my Raspberry Pi’s) is running a Media Center for my TV.

Installing Kodi on a Raspberry Pi

The installation of Kodi (formerly: XBMC) on the Raspberry Pi is simple – the easiest way is to download one of the SDCard Images that already contains a complete system (such as OpenELEC). This will get you started immediately and the casual user does not have to worry about the installation… until things stop to work! Which has happened to me…

Installing Kodi on Ubuntu

Twice now, my Kodi Installation has ceased to work (or work the way I wanted it to work). Unfortunately, finding the problem on the Raspberry Pi is a bit…tedious. Also, trying out things is (although theoretically you only need to make a backup image of the SDCard to roll back to a previous state). So I decided to get me a Kodi Installation on Ubuntu to try things out before rolling them out to the Raspberry Pi – and of course, the Ubuntu Machine is hosted as a Virtual Machine so I can take snapshots, roll back, take screenshots, etc.

My Virtual Machine has got 1 Processor with 4 Cores, 1024 MB RAM, and a 32 GB Disk (reflecting a larger SD Card for the Raspberry Pi). For Ubuntu, I have chosen the ubuntu-14.10-desktop-amd64.iso installation image. Next step was to perform a straight-forward standard installation of the operating system. Of course, once the OS was installed, I powered down the Virtual Machine and set a snapshot.

Before installing Kodi itself, I am patching the OS Installation to the latest releases of the packages – apt-get update and apt-get upgrade are my first steps. The next step is an addition of some standard packages to support maintenance of the Package Manager, apt-get. These are needed to install the actual Kodi Package which is not part of the default distribution. The following packages are installed

  • python-software-properties
  • pkg-config
  • software-properties-common

This can be done in a single command (assuming you have switched to superuser rights by now – sudo su)

apt-get install python-software-properties pkg-config software-properties-common

Image 01 - Package Manager Installation

As mentioned before, Kodi is not available from the default Package Archives – but the Kodi team offers its own Private Package Archive (or PPA). But we need to tell our Ubuntu Installation about it (again, under superuser privileges!)

add-apt-repository ppa:team-xbmc/ppa

Image 02 - Adding the PPA

With the new Package Archive added, the internal Package Database must be updated:

apt-get update

Now, we are ready to install Kodi – the following packages are needed:

  • kodi
  • kodi-audioencoder-*
  • kodi-pvr-*

Again, this can be done in a single command:

apt-get install kodi kodi-audioencoder-* kodi-pvr-*

These will install the core package, all audio-encoder packages and a set of add-on’s to Kodi. The next screenshot will show you in detail to what the package manager resolves the asterisks:

Image 03 - Adding Kodi and related Packages

After the installation, I am restarting the entire virtual machine – a) to be sure that the installation has cleanly initialized and b) to take a new snapshot before starting Kodi for the first time.

Configuring Kodi for the first time

Once the system has restarted, I can start Kodi from the Dash or via a Command Line.

Image 04 - Kodi in the Dash

Now, with Kodi started, I am where my Raspberry Pi takes me to automatically… time to play!

Image 05 - Kodi Main Menu

One of the first things to do when configuring a new instance of Kodi is to point it to the media files. A typical setup could either be a directly connected USB Drive (connected to the Raspberry Pi, that is) or the hosting of the media files on some accessible network share.

In my environment, I have implemented the second option – my media files are residing on a QNAP NAS with a share that allows read-only access to a user I am going to connect with from the Kodi Installation(s).

Image 06 - Setting up Media Files

Via Add Videos… you can now specify a Video Source – in my case, for a Windows Network/Samba Share. You need to specify the Server (I am using the NAS’s IP Address), the name of the Share (in my case “TV-Shows”), the Username (I am using “xmbc” which has read-only access to this folder) and the Password.

Image 07 - Media Source Configuration

Adding the Network Location now allows you to use it with the Video Source configuration dialog.

Image 07 - The Media Source

If everything is all right, you should then be presented with the content of your Video Source and a dialog for further configuration. Which is the next dialog, where you can specify the type of content in that Video Source and how you want it handled.

Your media files are just files to you – but Kodi can identify the files if you tip it off in the right direction. My Video Source contains TV Shows and I want to use a Scraper to index them. The Scraper for TV Shows is TheTVDB – a good description of the Scraper and the settings can be found here. With the right setting chosen, you can then “add” the Video Source and Kodi will automatically apply the Scraper Settings (which can take a while).

Addressing Problems

Foe one reason or another, my Content Scraper does not pick up all episodes of the TV Shows I am hosting in my Video Source. It used to work in the past – but now something is odd (which also happens on my Raspberry Pi and is the reason why I am going through this whole exercise here…)

First, I need to enable Kodi Debugging – that is done via the System Menu -> Settings -> System -> Debugging -> Enable debug logging.

Image 08 - Kodi Debugging

Kodi will immediately start to display overlay information about the system itself and shows the location of the Log File. I can now repeat the operation that cause trouble, i.e. re-scan my Video Source – which I do (to be on the safe side) by removing it, then re-adding it (which triggers a new configuration and a full new scan of the library).

Done with this, I leave Kodi via the Main menu – button in the lower left, then Exit. And open the File Manager in Ubuntu.

The File Manager, by default, does not show the hidden files we need now – as ./kodi is a hidden directory. Ctrl+H will – in the File Manager – quickly enable the display of those hidden items:

Image 09 - File Manager with Hidden Files

Go to ./kodi/temp and open the kodi.log file. Which in my case turns out an interesting information: for some reason, the Scraper plugin identifies the TV Show by it’s title but retrieves the information about a different show (with the same name) and then fails to find the episode matches.

Adding custom Info Files to assist the Scraper

Not sure why this is happening now but it is – and it also shows me what I should be doing: helping the Scraper to identify the TV Show properly. Information about the .nfo files can be found here.

There are multiple flavors for the .nfo files for TV Shows – I am trying the easiest: on the NAS (where the episode files are), I am creating a file called tvshow.nfo. Instead of specifying the exact information, I am just helping the scrapper by pointing it to the right URL in the TheTVDB.com database: go to thetvdb.com, search for your TV Show causing trouble) (e.g. “Miami Vice”) and then copy the show’s page URL (in this case http://thetvdb.com/?tab=series&id=77098) into the .nfo file.

You may have to remove the TV Show from the Database, then re-scan the Video Source but the Scraper will pick up the .nfo file and use this as the baseline for the episode identification.

This entry was posted in Raspberry Pi, Ubuntu and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.