Know this situation? You've installed an add-on for Kodi, been using it for a while and you've been very happy with it. And all of a sudden it stops working. Maybe due to an update, maybe because the add-on itself is using third party tools/URLs which are unavailable.
The source code of many Kodi add-ons are available in public code repositories (or short: repos). This gives you the possibility to report a problem to the add-on maintainer or even "fix" the add-on yourself.
In this article we share how to manually fix and update any Kodi add-on.
An example: Popcorn Time add-on
Out of all the add-ons we randomly picked one broken add-on which is widely used and this is the unofficial (and unsupported just FYI) Popcorn Time add-on. The latest release was 1.7.5 from the maintainer "Markop159".
The source code itself is available on the public repo on GitHub. By looking at the issues of this repository, one can see that there are a lot problems with the Popcorn Time add-on: The domain(s) the add-on uses in the background seem to be offline. However none of the issues were solved and no new version of Popcorn Time was released.
Fortunately GitHub user ubercracker8977 added a comment how to manually fix the add-on: By replacing the old domains with new ones. And this is where the manual work starts.
Fixing the add-on code
First the whole add-on repository should be cloned to your own machine using the git command.
git clone https://github.com/markop159/KODI-Popcorn-Time.git
This results in a local directory "KODI-Popcorn-Time" with the following contents:
As mentioned by the comment, the domains used inside the plugin code need to be replaced: The old domain(s) tv-v2.api-fetch.sh or tv-v2.api-fetch.website need to be replaced by the newer popcorn-ru.tk. To do this, open and edit the following files inside the "KODI-Popcorn-Time" folder:
- plugin.video.kodipopcorntime/resources/lib/kodipopcorntime/favourites.py
- plugin.video.kodipopcorntime/resources/lib/kodipopcorntime/providers/api-fetch.py
Once the files mentioned above were edited and saved, it's time to build a new add-on package!
Create a new add-on release (zip)
Kodi installs add-ons from zip files. The zip files contain the plugin itself but also meta data, which helps Kodi to keep track of the installed version. The meta data is saved in the file plugin.video.kodipopcorntime/addon.xml, which can also be found in the "KODI-Popcorn-Time" folder.
Open up this addon.xml file with an editor and adjust the plugin's version. You can also add yourself as provider, if it makes you happy and want to see your own name in Kodi :-):
The next file to be edited should be the changelog, although it's not absolutely necessary. Nevertheless, open changelog.txt with an editor and describe the change at the top of the file:
Now the add-on is actually ready! All what's left to do is to create a zip file of the "plugin.video.kodipopcorntime" folder (inside "KODI-Popcorn-Time" directory). Use the zip command or in your file explorer right-click on "plugin.video.kodipopcorntime" and create a zip file from it. Give it a senseful name, for example plugin.video.kodipopcorntime-1.8.0.zip:
Install the new add-on version in Kodi
Now that you have the zip file of the new add-on release (your very own release!), transfer it to Kodi (for example using Samba Share) or configure Kodi to access a certain source (for example a central network share).
In Kodi itself, select "Add-ons" in the left navigation, then on top of the Add-ons navigation click on the "package" icon. Select "Install from zip file" and select the location where you've placed the zip file. Now select the zip file you've created before. A message should appear "KODI Popcorn Time – Add-on updated" a few seconds later.
When you now open up the add-on information of Kodi Popcorn Time, you should see your own version and also yourself as provider.
General procedure to manually update a Kodi add-on
The steps above apply to any Kodi add-on. The only requirement is that the add-on code is somewhere publicly available (e.g. in a git repository). You could of course also use an existing zip file, extract the contents, fix the code and then create a new zip file. The procedure is always the same:
- Get the code (either code repository or from an extracted add-on zip file)
- Adjust (fix) the code
- Update version in addon.xml (line "addon id")
- Update changelog in changelog.txt (optional)
- Create new zip file
- Install the zip file in Kodi