5

I'm following the KODI/XBMC hello world addon tutorial here and i downloaded the finished project from here but the problem is that i cannot edit it, as ever time I try to add a version that I edited onto KODI it gives me the error Addon does not have correct structure I think it is the way I'm turning it back into a .zip(I am using the archive utility on a macbook air running yostimite), because even if I just unzip it and then without changing anything turn it back into a zip it still gives me that error, so I'm just wondering does anybody know what I'm doing wrong or do I need to use a special tool to make the plugin into a zip

I'm using openelec 5.0 on a raspberry pi B

Richard Beattie
  • 293
  • 1
  • 3
  • 17

8 Answers8

8

You will need to set it up like this:

  • zip (name doesn't matter)
    • folder with plugin name (ie plugin.program.hello.world)
      • plugin files including addon.xml, LICENSE.txt, changelog.txt, icon.png, etc

You don't need a special tool but you may be inadvertently compressing the zip. You could try Keka (or on SourceForge).

Enigma
  • 1,247
  • 3
  • 20
  • 51
  • It is still giving me the same error, I know it is the way I am turning it back into a zip as even if I just unzip the file and then turn it back into a zip without editing anything, I still get "structure is incorrect" error – Richard Beattie Feb 18 '15 at 16:09
  • try following this: http://www.maclife.com/article/columns/terminal_101_zip_and_unzip_files – Enigma Feb 18 '15 at 17:17
  • Can you make your zip file accessible somewhere? – Enigma Feb 18 '15 at 18:44
  • After restarting my computer I was able to zip the original addon without editing anything and run it, but when I edited a piece of text in the addon.py file and made a zip of the edited addon it gave me the same error the edited zip can be found here www.beattbots.complugin.program.hello.world-master.zip – Richard Beattie Feb 18 '15 at 19:25
  • zipinfo says the internal permissions are `-rw-r--r--` vs win: `-rw-a--` and linux: `-rw-rw-r--`. Try doing `chmod +w plugin.program.hello.world-master/*` before archiving. – Enigma Feb 18 '15 at 20:14
  • That changes the error from "Addon does not have correct structure" to "Installation failed" also I had to do "sudo chmod +rw plugin.program.hello.world-master/*" to get the premissons on the folder to read and write – Richard Beattie Feb 18 '15 at 20:42
  • Perhaps turn on debugging in Kodi and post the log file of the failed installation (incorrect structure log would also be helpful). – Enigma Feb 18 '15 at 20:46
  • the log file can be found at http://beattbots.com/kodi.log, it appers to be a problem with my addon's description. The addon error at the end is the "incorrect structure" addon – Richard Beattie Feb 18 '15 at 21:03
  • Try renaming addon.py to default.py. It looks like it's getting confused and attempting to get an addon description from the py instead of the xml. Also you should import the log into your question - at least the relevant bits. – Enigma Feb 18 '15 at 21:18
  • That did not work, however I discovered by restarting xbmc, and then installing the edited addon it works but I have to reboot xbmc everytime I want to update the addon – Richard Beattie Feb 18 '15 at 21:59
  • Hmm maybe the installation isn't handling the installation correctly. Can you test installing the same addon on a different platform ie mac? – Enigma Feb 18 '15 at 22:09
  • @Enigma i try to zip with winrar and keep getting same error! Any solution ? – user1788736 Nov 06 '15 at 16:13
  • @user1788736 try 7zip. make sure any compression settings are turned off. if that doesnt work, wipe the kodi plugin cache, plugin folders, etc – Enigma Nov 06 '15 at 18:12
  • @Enigma thanks for replying. How i can turn off compression on 7zip? – user1788736 Nov 06 '15 at 21:28
  • I have had a similar issue. Resolved it by writing Python script, which packages the files, omitting all "." prefixed file names (.DS_*). These are not visible if you don't use your command line. I still fail to package custom plugins, nevertheless. Even simple name changing causes the same issue. – ryzhiy Nov 09 '15 at 02:23
  • @user1788736 it's one of the options when doing `right click` > `add to archive...` > `pop up window for making the zip`. – Enigma Nov 09 '15 at 15:19
  • @ryzhiy you can also see those files by showing hidden files in explorer. – Enigma Nov 09 '15 at 15:20
  • 7
    well, it was a real mess, thus I decided to zip on a linux machine. One more issue that I've found is that if at least once the plugin loading fails, then you need to restart KODI in order to be able to re-add correctly plugin. – ryzhiy Nov 12 '15 at 07:37
  • @ryzhiy This drove me nuts all day until I read your comment. Restarted and it worked first time. – Gavin Ward Apr 15 '17 at 14:01
4

Although others have already raised the zip issue I feel my contribution brings enough new information to justify a new answer.

I recently faced the same issue. I created my Kodi plugin on a MacBook Pro (El Cap v10.11.1, Late 2013) and zipped the directory via Right-Click --> Compress and everything worked fine. I then started working on a different MacBook (El Cap, v10.11.2, Late 2013), made some changes and created the zip file the same way and I started getting the error.

After a few frustrating hours it occurred to me to analyse the zip structure. I used the following command: $ zipinfo script.service.autorun.zip and this is what I got:

// v10.11.1
Archive:  script.service.autorun.zip   1376 bytes   4 files
script.service.autorun/
script.service.autorun/addon.py
script.service.autorun/addon.xml
script.service.autorun/changelog.txt
4 files, 1328 bytes uncompressed, 646 bytes compressed:  51.4%

// v10.11.2
Archive:  script.service.autorun.zip   3060 bytes   10 files
script.service.autorun/
script.service.autorun/addon.py
__MACOSX/
__MACOSX/script.service.autorun/
__MACOSX/script.service.autorun/._addon.py
script.service.autorun/addon.xml
__MACOSX/script.service.autorun/._addon.xml
script.service.autorun/changelog.txt
__MACOSX/script.service.autorun/._changelog.txt
__MACOSX/._script.service.autorun
10 files, 2222 bytes uncompressed, 1230 bytes compressed:  44.6%

So, obviously, something changed in v10.11.2 but I couldn't find any documentation about it.

The solution for me was to manually zip the directory:

zip -r script.service.autorun.zip script.service.autorun/

Hope this helps!

LuisCien
  • 6,362
  • 4
  • 34
  • 42
3

I've been struggling with the same error - structure incorrect, while installing from zip file to Isengard 15.2.

Basically I'm downloading the zip file from a git repository and then trying to install.

I found the following:

addon.xml - if it has a newline on the end, that breaks things!

I can confirm what ryzhiy said in his comment above - if you try to install once and get the "incorrect structure" error then, even when you've fixed things, you will often get the same error with the same zipfile until you restart. Not sure why.

Hope this helps someone. I was able to fix mine by removing the newline from the en

James Thorpe
  • 56
  • 1
  • 7
1

Unzip and zip the folder again. It worked for me

Felipe Conde
  • 2,024
  • 23
  • 26
1

For me the problem was because of the compression of the zip file with the archive utility of Mac OS X. I solved it by writing the following command on the command line:

zip -r -0 nameofthezip.zip nameofthefolder

Using OS X El Capitan 10.11.4 for the compression and the addon is working with Kodi in a Raspberry Pi without problems.

Jaime L.
  • 11
  • 1
0

It depends on the way you zip it. I zipped it using 7zip and I got the error Addon does not have correct structure. After downloading a plugin zip file(any plugin zip file) and replacing the files within it started working fine.

Rajesh Kanna
  • 75
  • 1
  • 1
  • 8
0

Once you tried to install an invalid ZIP (because of invalid structure, i.e. because of hidden .DS from macOS) the error will reoccur even if you fixed that issue. To solve this you first have to restart KODI and then reinstall from ZIP again.

Sney
  • 2,486
  • 4
  • 32
  • 48
-1

I was having this issue and discovered that it was because of web content filtering rules in place on my network that interfered with the requests for the URL (specifically, the .zip)

Alexi
  • 1