[RELEASE] Repository Preparer (update to addons_xml_generator.py)
#1
Repository Preparer
(repo_prep.py)


Could an admin please sticky this? I think repository owners will find this very useful.

I've written an update / replacement to addons_xml_generator.py

The latest version will always be hosted here
https://github.com/unobtanium/xbmc_repo_...po_prep.py

Which you can download from here:
https://raw.github.com/unobtanium/xbmc_r...po_prep.py

This includes some code improvements and a function to automatically generate a compressed repository structure.

So now you get the benefits of compressing your addons without the having to manually rename the changelog, zip the file etc, just by running repo-prep.py when you need to update your addons.xml

Full readme:

Quote:This is an:
- addons.xml generator
- addons.xml.md5 generator
- optional auto-compressor (including handling of icons, fanart and changelog)

Compression of addons in repositories has many benefits, including:
- Protects addon downloads from corruption.
- Smaller addon filesize resulting in faster downloads and less space / bandwidth used on the repository.
- Ability to "roll back" addon updates in XBMC to previous versions.

To enable the auto-compressor, set the compress_addons setting to True
NOTE: the settings.py of repository aggregator will override this setting.
If you do this you must make sure the "datadir zip" parameter in the addon.xml of your repository file is set to "true".
Reply
#2
works perfect, cheers Big Grin
Reply
#3
just in the middle of modifying this to work in a little project i'm writing, but I was just wondering if there are any disadvantages to requiring compression? i.e. can I safely strip out the non-compressed code path without side-effects?
Reply
#4
not sure i follow, you'll have to try it and see if it works i guess Wink
Reply
#5
no advantage to non-compressed. only disadvantages (rollbacks no working, no quick reinstall).
Reply
#6
nice job, i just updated the addons_xml_generator.py for python 2.6. not sure if you've done that in yours.
For python coding questions first see http://mirrors.xbmc.org/docs/python-docs/
Reply
#7
thanks, i use python 2.7, and its worked for me. my changes to the xml generator were a bit more verbosity, and a check that it found at least one addon.xml before saving the xml and md5 files.

i'm not happy with the speed with which the update check takes, so i might remove that feature altogether to be honest
Reply
#8
removed the update feature and added a few code tweaks
Reply
#9
I'm getting SyntaxError with your latest code.
Code:
E:\Eden_Repo>python repo_prep.py
  File "repo_prep.py", line 242
    for root, dirs, files in os.walk(dir):
                                         ^
SyntaxError: invalid syntax

The previous commit seemed to work fine. Thanks for your efforts.
Reply
#10
thanks, i've fixed it now and pushed it to github. you can get the latest version from the links in the first post
Reply
#11
Hey - a few questions...

I've run this on a folder with 5 addons in it...made a bit of a mess as a result....

1. It seems to delete changelog.txt, not just create (say) changelog-0.2.2.txt - is that right? What about the next time is run, will it detect the -0.2.2 and auto update to the next addon version, 0.2.3 for example? I expected it to always look at the changelog.txt and change that to the current one..

2. It creates the .zip files inside the add on dirs themselves - traditionally I have them in a separate downloads folder, but I suppose this isn't a big deal. Will it delete older versions or will they just keep building up?

3. It seems to get the version numbers wrong on every second add on - first one is ok, but it uses this again for the next add on, the seems to get it right, then gets it wrong on the 4th or whatever. There's something not right going on there - have you tried this with a bunch of addons?

If you want to try what I am doing, clone my repo:
http://code.google.com/p/bossanova808-xb...e/checkout

...cd into staging and run repo_prep.py from there.

I am sure it's me being a duffer but there's not a lot of documentation to work with Smile

Any help appreciated!!
Sorry, no help w/out a *full debug log*
Reply
#12
Playing to day with this updated version and noticed when i set repo_root = True the script failes (or windows paths). (Windows machine, not yet tested on Linux)

It also generates errors when using a large sized skin addon (the zip seems to be fine though)

Edit:
Using a absolute windows path generates a syntax error.
Reply
#13
Just started using this, and works great to initially create the repo but still working out how to update addons and re run the script.
Reply
#14
Sorry i don't get it - it delete all sources and put them in zip file , what happens next time i have an update ?? this cannot be run from original source controlled folder (aka git folder)

every time one needs to copy entire source tree to somewhere else then run this script ?

too cumbersome for me

Shlomi
Reply
#15
error
Traceback (most recent call last):
File "C:/Users/JorEl/KodiMexico/miNuevoRepo/repo_prep.py", line 320, in <module>
if standalone: execute()
File "C:/Users/JorEl/KodiMexico/miNuevoRepo/repo_prep.py", line 316, in execute
Compressor()
File "C:/Users/JorEl/KodiMexico/miNuevoRepo/repo_prep.py", line 182, in __init__
if compress_addons: self.master()
File "C:/Users/JorEl/KodiMexico/miNuevoRepo/repo_prep.py", line 202, in master
addon_xml_exists = self._read_addon_xml()
File "C:/Users/JorEl/KodiMexico/miNuevoRepo/repo_prep.py", line 290, in _read_addon_xml
self.addon_xml = f.read()
File "C:\Users\JorEl\AppData\Local\Programs\Python\Python35-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x81 in position 937: character maps to <undefined>
Reply
 
Thread Rating:
  • 0 Vote(s) - 0 Average



Logout Mark Read Team Forum Stats Members Help
[RELEASE] Repository Preparer (update to addons_xml_generator.py)00