Kodi Library and Genesis Integration

Here is a quick guide on how to add TV Shows from the Genesis add on into the Kodi library.

This guide assumes you have Kodi installed  (I am using OpenElec so this guide refers to locations within Linux) and you have enabled the Genesis add on.

First thing we need to do is open the Genesis addon and browse to the TV Shows section.  Find a TV show from one of the sections and with it highlighted open the context menu, then select Add to Library.  This will create a folder within the addon, we will use this folder as a media source for the Kodi library.

Exit out back to the home screen and go to

Settings > Appearance > File Lists

Enable Show Hidden Files and Directories, return to the home screen and then go to

Videos > Files > Add Videos…

Browse to the following location:

home folder > .kodi > userdata > addon_data > plugin.video.genesis > TV shows

With the top level selected click ok to select the TV Shows directory, give the source a name or just accept the default “TV Shows” name.

Set the source content as TV Shows and allow the media source to be updated.  The TV show you added to the Genesis library will now appear in your Kodi library, you can then watch the episodes show without having to browse or search inside the Genesis add on, also any new episodes will automatically appear in your library when you run a library update.

To add more TV shows to the Kodi library go back to the Genesis add on and repeat the above steps however this time you do not need to add another source because you have already done that. Instead the additional shows you added to the Genesis library will automatically appear in the Kodi library after a library update.

You can also do this with Movies, just repeat the above steps but create another source and point it towards the movies folder within the plugin.video.genesis folder.


Setting up FileBot TV Renamer on a Raspberry Pi

Update 09/06/2017

This post is outdated as the version listed doesnt exist, the version that does exist doesnt work properly for some reason.  As such i have written a new blog page showing how to get the latest version working with Raspbian Jessie Lite.

FileBot on Raspbian Jessie

FileBot is a File Renaming Utility specifically designed for renaming TV shows. The application is available for lots of different platforms including Windows, Mac, Linux and even NAS devices.   We are interested in the Embedded Linux package as this contains everything needed to get it up and running on Raspbian.

This guide assumes you already have the latest version of Raspbian setup and running on your Raspberry Pi.

First off we will create a folder in your home directory to store the download, the download is an IPK which we will need to extract after it has been downloaded. NOTE: at time of writing 4.5.6 was the latest version, best to check the FileBot website to see if there is a later version available)

mkdir filebot

cd filebot

Then run this command to download the application

wget http://sourceforge.net/projects/filebot/files/filebot/FileBot_4.5.6/filebot_4.5.6_arm.ipk

Once downloaded we will need to extract the files in the IPK, to do this we will use the AR utility.

sudo ar -x filebot_4.5.6_arm.ipk

This will extract the contents of the file into our filebot folder, type LS to see a folder list and you will see a new file called “data.tar”

sudo tar -xvf data.tar

This will extract contents of the tarball and put the contents into our filebot folder, type LS again and you will see a new folder called “opt”.  We must now copy the contents of the opt folder into that system /opt/ folder to ensure this works correctly.  NOTE: you can edit the filebot.sh script (located in the /opt/share/filebot/bin/ folder) and run this from any location you wish however for ease of use i am going to install this application into the location specified in the script.   Run the following to copy the share folder into /opt/

sudo cp ~/filebot/opt/* /opt/

We should now change the ownership on the FileBot folder, this is an optional step but without it you will have to invoke your script with the sudo command to ensure the FileBot directories are written to correctly.  To change the ownership run the following command:

sudo chown -R pi /opt/share

We now need to create a script which runs the filebot.sh script and pass some arguments in, the FileBot CLI web page as a list of the available commands and it is well worth a read to understand what this utility can actually do.  For myself i have a simple script which renames any media in a download folder called TV and moves the media after it has been renamed to a folder called TV Shows on my NAS.  This is setup as a source in OpenElec which means new media is scanned into my library.  To create my script create a folder called scripts in your home directory

mkdir scripts

cd scripts

We must then create our script, call it what ever you want

nano tvrenamer.sh

We must then create our script, i am going to use the following arguments

My script is below, this script runs filebot.sh and makes the application look at my transmission downloads folder, renames them with the format “Series NameSeries # x Episode #Title” and moves the media file to a folder with the Series Name/Season #. It uses “thetvdb” for the metadata to ensure the correct show and data is picked, i have also added the date and time to the script so when my cron task runs it updates the log file with the date and time.


DATE_STAMP=’date +%d-%m-%Y-%T’
echo ${DATE_STAMP}

/opt/share/filebot/bin/filebot.sh -rename /mnt/downloads/transmission/complete/TV/* –format “/mnt/videos/TV Shows/{n}/Season {s}/{n} – {sxe} – {t}” –db thetvdb -non-strict

Save the script, make it executable and run the script to test

sudo chmod +x tvrenamer.sh


This script can then be run via a cron schedule to ensure media is renamed automatically, i run this every 30 minutes.  To do this edit the crontab by entering the command

sudo crontab -e

At the bottom of the file add the following line, this runs the script every 30 minutes and creates a log file of the output so you can view any problems.

*/30 * * * * ~/scripts/tvrenamer.sh >> ~/scripts/tvrenamer.log 2>&1

Enjoy your automated renaming system, if you wish you can clean up the downloaded files from earlier by running

sudo rm -fr ~/filebot

How to Exit N64 Games on Retropie using Mupen64Plus and an XBOX 360 Controller

Mupen64Plus is regarded as the better performing N64 emulator on Retropie.  However the default configuration doesn’t work so well with the XBOX 360 controller.

One of the main problems is that with the default configuration you can only exit the emulator with a keyboard, the emulator supports exiting with a controller however you need to manually configure it.  To do that you also need to know your button mappings, i have covered how to find this in this post.

Once you have your button mappings we can start by navigating to the emulator config folder, to do this enter the following:

cd /opt/retropie/configs/n64

Then open the mupen64plus.cfg file

sudo nano mupen64plus.cfg

Scroll down the config file until you find “[Core Events]” section, then locate the setting “Joy Mapping Stop

I use the XBOX Guide button to exit the emulator, this is button 14 however you can use any button, just substitute the button number for the one you want to use.

The value you need is:

Joy Mapping Stop = “J0B14”

J0 is Joystick 0 and B is for button so in this case button 14.  Save the file and reboot, you should now be able to exit N64 games and return to the EmulationStation User Interface.


Using an XBOX 360 Controller on RetroPie

By default Raspbian and RetroPie come preinstalled with xpad, this is the system XBOX 360 driver and although it works it doesnt work as well as xboxdrv.  So here is a quick guide on getting xboxdrv setup with RetroPie.  This guide assumes you already have RetroPie installed on your Raspberry Pi.

First thing we need to do is disable xpad, easiest way of doing this is to add the driver to the raspi-blacklist.conf file, to do that run the following command at the terminal or SSH prompt:

sudo nano /etc/modprobe.d/raspi-blacklist.conf

This file didn’t exist for me so don’t be alarmed if a new file is created, in the file add the following text:

blacklist xpad

Now Reboot your Raspberry Pi

sudo reboot

Once the Pi has rebooted download xboxdrv by entering the following command:

sudo apt-get install xboxdrv

Once that has installed we need to configure the driver to load at start up, this page on GitHub was written by the RetroPie creator and is comprehensive enough to get you through but i will try and explain a little more of the steps to make sure it works first time with your emulators.

I used setup 3 (init script) as it apparently uses less CPU and RAM.  Create the file as described on the GitHub page by entering the following command:

sudo nano /etc/init.d/xboxdrv

Copy the code script from here and paste it into the blank script, press CTRL+X and save the file.  Make the script executable and then execute the script to ensure it starts without error by running these two commands:

sudo chmod +x /etc/init.d/xboxdrv

sudo update-rc.d xboxdrv start

Then you need to create a configuration file, here you can tell the system how many controllers to load.  Enter the following command to create the configuration file:

sudo nano /etc/default/xboxdrv

Copy and paste the configuration from the GitHub page, change the value of CONTROLLER_NUM to match how many controllers you want to load, 2 is default.  Save the file by pressing CTRL+X.


Ensure your controller is connected and reboot your Pi, once rebooted the controller light should be correctly lit as Player 1.  We can now test so make sure the inputs are working correctly, we do this by installing joystick and running jstest.  Run the following command to install the joystick application:

sudo apt-get install joystick

Once installed run the following command, substituting [0-3] for a single number.  Normally 0 is the first controller but if you are using a keyboard that might get detected as [0] so use [1].

jstest /dev/input/js[0-3]

You should get an output on the screen showing the button assignments, if you press a button the output will change from Off to On.  It is worth making a note of the button assignments because you will need them later when configuring emulators to use the correct buttons.  Here are the default button assignments for the XBOX 360 controller:

A – 4
B -5
X – 6
Y – 7
RB – 9
LB – 8
RT – 11
LT – 10
back – 12
start – 13
dpad-up – 0
dpad-down – 1
dpad-left – 2
dpad-right – 3
Left Thumb Down – 15
Right Thumb Down – 16
Left Thumb Axis Up/Down – Axis 1
Left Thumb Axis Left/Right – Axis 0
Right Thumb Axis Up/Down – Axis 3
Right Thumb Axis Left/Right – Axis 2
Xbox Button – 14

Now we need to configure RetroPie to use the new controller, this will be the default button configuration for emulators that use the RetroArch core.  Emulators that use other cores such as Mupen64Plus will need re-configuring separately.  Before we start we need to ensure that we have read and write permissions on Retroarch config folder, run the following command to change the permissions:

sudo chmod +rw /opt/retropie/configs/all/

Then navigate to the Retroarch emulator core folder

cd /opt/retropie/emulators/retroarch/

Run the configuration script for each controller you want to use, if you are only using 1 controller run the first line, if you are using 2 controllers run both the first and second lines and so on…

./retroarch-joyconfig -o /opt/retropie/configs/all/p1.cfg -p 1 -j 0

./retroarch-joyconfig -o /opt/retropie/configs/all/p2.cfg -p 2 -j 1

./retroarch-joyconfig -o /opt/retropie/configs/all/p3.cfg -p 3 -j 2

./retroarch-joyconfig -o /opt/retropie/configs/all/p4.cfg -p 4 -j 3

Follow the on screen prompts, you will be asked to press each button in sequence.  Doing so will create a map file for each controller, we then need to combine the map file with the Retroarch configuration file so the core knows what buttons to use on your controller.  To do this run the following command to combine the text in the files:

sudo cat /opt/retropie/configs/all/p*.cfg >> /opt/retropie/configs/all/retroarch.cfg

Perform one last reboot and run a game, the buttons should now work however they might be wrong for the emulator you are playing.  To change this you need to take the mapping from the Retroarch.cfg file in the “ALL” folder (global config) and add it to the Retroarch.cfg file of the emulator you are using i.e SNES.   This will allow you to map the original SNES buttons to the XBOX 360 controller buttons giving you the best setup possible.

I will show you have to do that in another guide, i will also show you have to setup the hotkey buttons and how to exit the games and return to the EmulationStation User Interface.


Hi, welcome to my blog.  I have never had a blog before but i thought it was about time i started writing down some of the random tech projects i take on, hopefully someone will find the information here useful for your own projects.