This article describes how to install a Github Kodi Program Addon "Insert/Swap Kodi Favourites" that allows you to easily re-arrange (manage) your Kodi Favourites list. I also show you how to install the MB-KODI repository that has the latest version of the Addon (also hosted on GitHub).
The "Insert/Swap Kodi Favourites" Addon is configurable, meaning that it has an Configuration panel that allows you to decided on how the Addon will edit your Favourites (by either Swapping or Inserting) as well as lets you adjust the label font size (small/medium/large) and/or the thumbnail size (small/large) for the editing panel.
Issue - Why The Need for the Addon
There was an Addon for ordering your Kodi Favourites called "Order Favourites" that allowed users to edit their Kodi Favourites, however I noticed that it did not work for skins other the than the default Estuary skin and was not configurable so it only lets users "swap" Favourite entries. I am using the Confluence skin and currently the owner (who I contacted) had no intentions to improve on the Addon and also did not host the Addon in a Repository.
I decided that I wanted to create my own version of the Addon and build my own Repository on GitHub to serve up the fixed/improved version of the Addon. The challenge is that I wanted not only to add the ability to configure the Addon using the configuration screen, but also have the Addon work for all skins and provide the details of which "editing mode" the Addon was configured. The Addon should allow the user to configure how to "edit" the users' Favourites (i.e. either 'swap' the Favourites or 'insert' them before or after a target). I also wanted the ability for the user to define the label font size and the thumbnail size and needed the Addon to remember these settings. So I created the "Insert/Swap Kodi Favourites" Program Addon.
Insert/Swap Kodi Favourites - Program Addon
Introducing the "Insert/Swap Kodi Favourites" Program Addon. A simple Kodi Program Addon that lets your easily edit your Kodi Favourites list that is configurable - meaning that you set how the Addon will act on your Favouites (Swap or Insert) and allows you to adjust the label font size (small/medium/large) and the size of the thumbnails that that editor screen will display (small or large)
ReadMe file for the "Insert/Swap Kodi Favourites" Program Addon
To Do / Wish List for the "Insert/Swap Kodi Favourites" Program Addon
Repository and Addon Now Published on GitHub - How to Load
Here is where you can find the MB-KODI Repository that has a Program Addon "Insert/Swap Kodi Favourites" included. Simply add a source in your Kodi file manager using the Repository Web Address below. Then "Install from zip" and use the source that you added to load the repository. Kodi will load the Repository. Then under Addons - use "Install from Repository" and use the newly installed "MB-KODI" repository to install the "Insert/Swap Kodi Favourites" Program Addon.
MB-KODI Repository Code (on github.com)
Repository Web Address: https://m-borsch.github.io/MB-KODI/
Challenges Encountered in Addon Development
These are some of the challenges encountered during the development of the Addon and how they were overcome.
How to Store Settings
The app needed to store the Addon settings.
Solution
This was relatively simple as Kodi provides a standard approach to handling settings for Addons, storing them in a settings.xml file in the addon data location. This file can be loaded each time the Addon is launched.
How to Pass Data - Python to XML?
The biggest challenge is that the core code for the Addon is written in Python yet the "Skin" (the GUI) is written in xml. This makes it difficult to pass data between these environments.
Here is the modal dialog box - it is the editing popup you can see on the right side, I wanted to show what ordering method was configured for the Addon and a hint as to what the current mode does. Basically, I wanted the popup screen to be 'contextual' with the text changing depending on what the user had previously set in the configuration panel.
Close up:
Solution
The solution was to use "properties" of a window to pass the data back and forth. In my case, I have a configuration screen that allows the user to select which ordering method (action) that they want the Addon to execute on the Favorites list. The 'trick' is to read the settings.xml file on the launch of the Addon and store it in the main Window as a 'property' (i.e. variable) that can be referenced as needed. Also, when the user wants to edit the Favourites list, you have to create a modal dialog. Here you also store the value of the order method using the window handle (id) in a 'property' (variable) of the modal dialog window. Then in the xml code, you can reference this dialog variable - relative to the currently active window (the modal dialog window):
Python Code:
XML Code:
The variable that is set in the Window properties (in this case the modal dialog) is called 'reorder'. The values can be 0, 1 or 2 - indicating the 3 options in the Configuration screen (0 - Swap, 1 - Insert A after B, or 2 Insert A before B).
From the Settings/xml (configuration file). This is where you define the setting that you want to show in the configuration popup:
Steps to Creating an Addon/Repository
- Create an identity on GitHub. I created "M-Borsch" on GitHub: M-Borsch (Mike Borsch) (github.com)
- Create your Addon. In my case I created a Program Addon "Insert/Swap Kodi Favourites": https://github.com/M-Borsch/Insert-Swap-Kodi-Favourites
- Create a Repository and add your Addon into the Repository.
- Edit the index.html page in the root of the Repository to deliver your repo.
- Create a web presence to host your Repository
- To do this you need to use the "Settings - Pages" area and deploy from your default branch. This will use your index.html to create a default landing page that can serve up your releases of your repo.
Tips / Tricks
These are some of the challenges that I discovered during the development of the Repository and Addon.
- Be careful developing on Windows (appears to have caching challenges)
- I noted that when you attempt to load an Addon or Repository you may get a "Failed to load...."
- This happens when you delete a previous version and attempt to load a new one
- This does not necessarily mean that there is something wrong with your package (zip), Simply exit Kodi - re-launch and try your load again
- At one point, I was unable to re-load my Repository. It loaded successfully but a previous version of the associated Addon was being delivered.
- I attempted to clear the cache in Kodi but was not successful in getting the new addon to be delivered from the revised Repository. I loaded the repo on another Unix based box running CoreElec and it worked fine. I eventually ended up having to un-install Kodi (deleting the profile) on the Windows machine and start over to get it to load correctly. Very frustrating.
- You need to create an md5 file for your "addons" file.
- I used powershell and "get-filehash" on Windows to create my SHA256 code for your addons.xml.md5 file
- I noted that when you attempt to load an Addon or Repository you may get a "Failed to load...."
Comments powered by CComment