How to customise Confluence sub-menus in Kodi (XBMC)
Although Kodi is well documented via the wiki and forums, I couldn’t find a tutorial that explained how to customise the base theme (Confluence) to have custom sub-menus. The idea was to separate the various genres of TV shows and Movie libraries into distinct menu options. As an example I have Anime, Kids and regular TV shows in my library but I don’t want to see them in the same view. Themes such as Aeon Flux allow a lot of customisation out of the box and you can achieve this using smart playlists and custom menus but in the end I was happiest with Confluence as long as I could set the menus/sub menus.
The process
First up is separating your media. Although you could do it via genre or tags / other, it doesn’t give full control into the separation. An example of my file structure is below.
Anime |- Movies |- TV Kids |- Movies |- TV TV Series
This structure allows the use of smart playlists based on path filtering. Make sure you’ve added these as sources in Kodi/XBMC and set the appropriate content on each folder (the source can just be the root though).
Smart playlists
Next create your smart playlists. You can either use the editor built in to Kodi/XBMC or you can create it manually with an XML editor (or notepad equivalent). The location of these will be in your userdata folder (this means they can be backed up, are portable and will survive updates, etc.). The location varies based on operating system, for my windows machine this was…
%AppData%\Kodi\userdata\playlists
The location for other operating systems can be found in the Kodi userdata wiki. Also I was only tackling videos so it was further in the video folder (the process should be the same for music/mixed content). I was pretty comfortable editing manually as most of my playlists were very similar and only varied in path filter and label. See below an example.
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?> <smartplaylist type="tvshows"> <name>Anime</name> <match>all</match> <rule field="path" operator="startswith"> <value>smb://192.168.1.109/EX2/Anime/TV/</value> </rule> </smartplaylist>
The rule could use the “contains” operator instead and just check for “Anime/TV/” or similar. You can add other conditions and also ordering is possible. Many other options can be found in the Kodi smart playlist wiki. The wiki also shows the method using Kodi/XBMC which many will be more comfortable with.
Sub menus
Finally the next step was a bit harder to dig up info around. There was a modded customisable version of Confluence doing the rounds in the past and although I didn’t try it, I had read that it’s not really supported anymore. No matter, it’s still fairly easy to set up the sub-menus (or even main menus for that matter).
First thing to do is copy the “skin.confluence” folder from the main Kodi folder into the addons folder one level up from your userdata section. This again allows you to back up and restore your set up at any point in the future. Again in the case of a windows installation the main folder was at this location…
C:\Program Files (x86)\Kodi\addons
The folder it was copied to was…
%AppData%\Kodi\addons
Now inside this folder you’ll find a “720p” folder. In here you’re looking to edit “IncludesHomeMenuItems.xml” (might want to take a back up incase you edit something incorrectly and need to get back to how it was).
Open it up in your XML editor of choice (or NotePad/TextEdit/nano will do), I prefer Sublime Text 2. The structure is simple includes > include > control. You’re looking to add/remove controls within the include of choice. I wanted my sub-menus under Movies and TVShows so this meant adding/removing controls from “HomeSubMenuMovies” and “HomeSubMenuTVShows” respectively. Leave the image controls at the start and end alone (they’re just for the look of the submenus at their ends). Changing the control order in the file changes the order in Kodi/XBMC.
It’s hard to know what the existing controls are for because their label tag points to an id (of stored label names) rather than an actual label. However the onclick tag gives it away. Most are using the ActivateWindow() function (which we will also use) in the format of, for example (Videos, MoviesActors, return). What this means is it’s using the Videos library, targeting movies, grouped by actors (ignore the return, it has to do with the action when you click back, whether you return to the root menu or not). The following page in the Kodi wiki explains the ActivateWindow function and it’s parameters.
So what we want to do is remove (or comment out using <!— —>) those controls we don’t care about. I commented out the movie genre, actors and years controls as I rarely use them. Now we add our items and target our smart playlists. Below is an example.
<control type="button" id="99000"> <include>ButtonHomeSubCommonValues</include> <label>Kids</label> <onclick>ActivateWindow(Videos,special://userdata/playlists/video/KidsMovies.xsp,return)</onclick> </control>
It’s quite similar to the existing items except I’ve explicitly placed a text label there and the ActivateWindow function is a bit different this time. I’m still targeting the Videos database, however I’m using the “special” (protocol I guess it could be called) to get to our userdata path and then target the respective smart playlist. Now take note, your controls all need an Id and it needs to be unique for each of them. I started at the 99000s as nothing else in the file had these.
Btw, editing the main menu items is also simple, just look in the “Home.xml” file instead.