Problems with packaging zip for an addon (Unable to load ... addon.xml, Line 0)
#1
This is one of the most bizarre things I have seen; I use Kodi 19.5 on Android 7 device. Here are steps to reproduce:
  • Go to https://github.com/mintsoft/repo-plugins...sitystream - it contains fix for a Kodi addon
  • Since I just want the directory zipped (do not want to get the entire git repository), go to https://download-directory.github.io/ - and paste the previous link in the field that says "Paste GitHub.com folder URL + press Enter" and ... press Enter
  • A zip called "mintsoft repo-plugins curiositystream-matrix-fix plugin.video.curiositystream.zip" will be downloaded
This zip does not have the right folder structure for a Kodi addon; so re-pack it
  • first, unzip it into a directory (on my Ubuntu 20.04, "Extract Here" will extract the files in the zip in a newly created directory called "mintsoft repo-plugins curiositystream-matrix-fix plugin.video.curiositystream")
  • Rename the unzipped directory "mintsoft repo-plugins curiositystream-matrix-fix plugin.video.curiositystream" to "plugin.video.curiositystream"
  • Finally, zip the newly renamed *directory* "plugin.video.curiositystream" into a new zip file, "plugin.video.curiositystream_fix_2.0.2+matrix.2_mintsoft.zip"
    • From the bash command line, this can be done (if you're in the parent directory) with:
      bash:
      zip -r plugin.video.curiositystream_fix_2.0.2+matrix.2_mintsoft.zip plugin.video.curiositystream
  • Copy the newly created plugin.video.curiositystream_fix_2.0.2+matrix.2_mintsoft.zip to somewhere where Kodi can read it.
Now, if I install this plugin.video.curiositystream_fix_2.0.2+matrix.2_mintsoft.zip in Kodi via "Install from zip file" - it installs and works fine; great!

Now do this:
  • Find the file router.py in the unpacked directory: plugin.video.curiositystream/resources/lib/router.py and open it in a text editor
  • Find the line "def _play_media(self, media):" - then find the line "play_item.setSubtitles([c["file"] for c in stream["subtitles"]])" right after it; here press Enter to add a newline, then save the router.py file
  • Remove the previous zip file "plugin.video.curiositystream_fix_2.0.2+matrix.2_mintsoft.zip"
  • Again zip the directory "plugin.video.curiositystream" into a zip file "plugin.video.curiositystream_fix_2.0.2+matrix.2_mintsoft.zip"
  • Have Kodi install this updated zip via "Install from zip file": it will report "Installation failed"
Now this is absolutely bizarre - for one, adding a whitespace to a Python script does not change the code; then also the new .zip opens on the PC without a problem - so WHY IS THERE AN ERROR AT ALLHuhHuh?

Log viewer says:

Code:
2023-01-24 18:31:08.577 T:13813 ERROR <general>: Failed to unpack archive 'zip://nfs%3a%2f%2f1...%2fplugin.video.curiositystream_fix_2.0.2%2bmatrix.2_mintsoft.zip/plugin.video.curiositystream/' to '/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/temp/a2e31590-a27d-4d9a-b903-7e24e0c4d194'

Ok, thanks - WHY did you fail to unpack the archive? How come you did not fail to unpack the archive last time? So fucking stupid ...

Then, for good measure - erase that line you've added to router.py, then recreate the .zip again - and try to install it in Kodi: yes, it installs fine, "Add-on updated" (!!!)

Then, again add a new line at the same position, add enough spaces so intentation matches, and write
Code:
print("aaa")
, and save the file. Then recreate the .zip again - and try to install it in Kodi. Result: "Failed to install add-on from zip file"; and Kodi log says:

Code:
2023-01-24 18:43:32.898 T:6487 ERROR <general>: CAddonInfoBuilder::Generate: Unable to load 'zip://nfs%3a%2f%2f1...%2fplugin.video.curiositystream_fix_2.0.2%2bmatrix.2_mintsoft.zip/plugin.video.curiositystream/addon.xml', Line 0
                                                Failed to open file

WTF - how does a change to "router.py" result with error in "addon.xml" at line 0? This is insane ...

I really don't understand why these changes to the zip cause such problems; I've tried hacking Kodi addons before, and I've never had this problem before.

Has the procedure for creating .zips changed? Maybe I have to cryptographically sign them now, or some procedure like that? Is the format and the procedure of creating an Addon zip for Kodi documented anywhere?

What the hell is going on here?
Reply
#2
tl;dr however there is an Kodi issue if you uninstall and reinstall and addon without a Kodi restart that could be related to your issue.

Martin
Reply
#3
@swind_ml I can see you are frustrated but please try to mind your language when writing posts on the forums. We endeavour to be a family friendly place.
Always read the Wiki, FAQ and search the forum before posting.
Read/follow the forum rules.
Reply
#4
@swind_ml ensure you are zipping the parent folder into the addon.zip you are creating, when you open the zip "addon.xml" should be in a subfolder not the root of the archive
could you provide your modified zip for inspection?
Reply
#5
Thanks for the responses, all:

(2023-01-24, 20:00)Dangelus Wrote: @swind_ml I can see you are frustrated but please try to mind your language when writing posts on the forums. We endeavour to be a family friendly place.

Sorry about that; it's just that I wasted like three+ hours of my life on this, and made no progress apart from getting meaningless error messages.

In any case I wanted to edit my post right now, but I cannot: "Editing or Deleting your own posts" https://forum.kodi.tv/showthread.php?tid=342174


jepsizofye Wrote:@swind_ml ensure you are zipping the parent folder into the addon.zip you are creating, when you open the zip "addon.xml" should be in a subfolder not the root of the archive

Sure, that is why I gave the zip command line, that is exactly what it does - zips the parent folder.

jepsizofye Wrote:could you provide your modified zip for inspection?

Sure - I've posted the last edition of the .zip as described in OP (with the added print command) in here:
https://file.io/vQg1OhYTCOfR

jepsizofye Wrote:tl;dr however there is an Kodi issue if you uninstall and reinstall and addon without a Kodi restart that could be related to your issue.

I guess that is probably what the problem is - probably there is some "cached" version of the addon somewhere, and then it conflicts as soon as there are differences in an updated addon file?

Although cannot try it right now, will have to try it later ...
Reply
#6
Ughhh, so stupid that I cannot edit my post - turns out that link in previous list is wrong (stupid file sharing services - god I hate technology so much, only thing it does is make your life more difficult, what a collosal waste of time) I *hope* this is the right one https://file.io/vQg1OhYTCOfR
Reply
#7
Oh, well, - stupid I cannot edit my post, but it turns out my file on https://file.io/vQg1OhYTCOfR was deleted (what a stupid file sharing service)

Where should I post this file, considering this forum has no facility to upload attachments?
Reply
#8
try https://transfer.sh/ to upload not sure whats up with your chosen hoster

sorry for the dumb response about the folder structure but if you read the questions here long enough youll figure out you need to verify the simplest things
Reply
#9
It's a forum anti-spam measure. Your account is still at newbie status, so the edit priv isn't enabled yet as we got too many examples of drive-by spamming from bots who posted something "innocent", then came back later and used the edit priv to actually drop their payload.

We don't offer any file hosting/uploading options aside from log (text) files, so you'll have to use something publically available on the 'net or self-host it.
|Banned add-ons (wiki)|Forum rules (wiki)|VPN policy (wiki)|First time user (wiki)|FAQs (wiki) Troubleshooting (wiki)|Add-ons (wiki)|Free content (wiki)|Debug Log (wiki)|

Kodi Blog Posts
Reply
#10
Hi all - thanks again for the responses, I think it is solved now - based on this:
(2023-01-24, 19:55)emveepee Wrote: tl;dr however there is an Kodi issue if you uninstall and reinstall and addon without a Kodi restart that could be related to your issue.

So I tried first: uninstall addon (erasing settings too), then install modified addon - failure (so at this point there is no CuriosityStream addon).

So, then I fully closed Kodi on Android via the Kodi power button, waited a couple of seconds, then started Kodi again - then tried to install modified addon - it worked!! (of course, I had to reenter my login credentials, but all works fine).
(2023-01-24, 20:42)jepsizofye Wrote: try https://transfer.sh/ to upload not sure whats up with your chosen hoster

Not even my chosen hoster - for some reason, I haven't used file upload in quite a while, and didn't feel like being exposed to all of the WeTransfer ads and such, so I thought I'd look up a service quickly ... and I was not lucky
(2023-01-24, 20:42)jepsizofye Wrote: sorry for the dumb response about the folder structure but if you read the questions here long enough youll figure out you need to verify the simplest things

Not dumb at all, you're right to want to verify - if I didn't lose my cool after being so frustrated with this problem, I would have thought in advance to upload somewhere, precisely to allow others to inspect. But eh ...
(2023-01-24, 20:42)DarrenHill Wrote: It's a forum anti-spam measure. Your account is still at newbie status, so the edit priv isn't enabled yet as we got too many examples of drive-by spamming from bots who posted something "innocent", then came back later and used the edit priv to actually drop their payload.

We don't offer any file hosting/uploading options aside from log (text) files, so you'll have to use something publically available on the 'net or self-host it.

Thanks for the explanation - and I understand fully!

I guess, one problem that I have with all forums that need to be locked down, but which I do not use very often to remember the "standard operating procedure" - is that they do not notify you "in advance": in some forums, for instance, as a newbie, I'm prohibited to post links. So, I spend an hour formatting a post with 50 links - and the system does NOT inform you when you've pasted your first link (even if there is JavaScript "live preview" parsing and all those bells and whistles), no - only after I've spent time for formatting all 50 links and hit "post" - THEN it tells me "nono, you cannot post links"; in such a case, a notification upon the paste of very first URL as in "Apologies, your status does not allow you to post links" would go a LONG way ... Thankfully, not a problem on this forum - just mentioned as an illustration of what I find extra irritating on forums - and hard to handle, especially when frustrated with another problem, that ultimately forced me to post.

Anyways, thanks all for the assistance - great to get this working again!
Reply
#11
right on
Reply

Logout Mark Read Team Forum Stats Members Help
Problems with packaging zip for an addon (Unable to load ... addon.xml, Line 0)0