Skip to content
Browse files

addon repository

  • Loading branch information...
1 parent 31d1adf commit 967705746e15585e3912a32d1bf0aa302037f75f killdash9 committed Jul 27, 2012
View
26 addons.xml
@@ -0,0 +1,26 @@
+<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
+<addons>
+<addon id="script.video.parentalcontrols" name="Parental Controls" version="1.4" provider-name="killdash9">
+ <requires>
+ <import addon="xbmc.python" version="2.0"/>
+ </requires>
+ <extension point="xbmc.python.script" library="resources/lib/parentalcontrols/settings.py">
+ <provides>executable</provides>
+ </extension>
+ <extension point="xbmc.service" library="resources/lib/parentalcontrols/service.py" start="login">
+ </extension>
+ <extension point="xbmc.python.module"
+ library="resources/lib" />
+ <extension point="xbmc.addon.metadata">
+ <summary lang="en">Parental Controls</summary>
+ <description lang="en">A parental controls addon. Works only with sources that provide ratings such as HULU.</description>
+ <platform>all</platform>
+ </extension>
+ <extension point="xbmc.addon.repository"
+ name="XBMC Parental Controls Repository">
+ <info compressed="false">https://github.com/killdash9/xbmc-parental-controls/raw/master/addons.xml</info>
+ <checksum>https://github.com/killdash9/xbmc-parental-controls/raw/master/repo/addons.xml.md5</checksum>
+ <datadir zip="true">https://github.com/killdash9/xbmc-parental-controls/raw/master/repo</datadir>
+ </extension>
+</addon>
+</addons>
View
1 addons.xml.md5
@@ -0,0 +1 @@
+046f364c6e5776ca2b7833ca0cbea266
View
73 addons_xml_generator.py
@@ -0,0 +1,73 @@
+""" addons.xml generator """
+
+import os
+import md5
+
+
+class Generator:
+ """
+ Generates a new addons.xml file from each addons addon.xml file
+ and a new addons.xml.md5 hash file. Must be run from the root of
+ the checked-out repo. Only handles single depth folder structure.
+ """
+ def __init__( self ):
+ # generate files
+ self._generate_addons_file()
+ self._generate_md5_file()
+ # notify user
+ print "Finished updating addons xml and md5 files"
+
+ def _generate_addons_file( self ):
+ # addon list
+ addons = os.listdir( "." )
+ # final addons text
+ addons_xml = u"<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n<addons>\n"
+ # loop thru and add each addons addon.xml file
+ for addon in addons:
+ try:
+ # skip any file or .svn folder
+ if ( not os.path.isdir( addon ) or addon == ".svn" ): continue
+ # create path
+ _path = os.path.join( addon, "addon.xml" )
+ # split lines for stripping
+ xml_lines = open( _path, "r" ).read().splitlines()
+ # new addon
+ addon_xml = ""
+ # loop thru cleaning each line
+ for line in xml_lines:
+ # skip encoding format line
+ if ( line.find( "<?xml" ) >= 0 ): continue
+ # add line
+ addon_xml += unicode( line.rstrip() + "\n", "UTF-8" )
+ # we succeeded so add to our final addons.xml text
+ addons_xml += addon_xml.rstrip() + "\n\n"
+ except Exception, e:
+ # missing or poorly formatted addon.xml
+ print "Excluding %s for %s" % ( _path, e, )
+ # clean and add closing tag
+ addons_xml = addons_xml.strip() + u"\n</addons>\n"
+ # save file
+ self._save_file( addons_xml.encode( "UTF-8" ), file="addons.xml" )
+
+ def _generate_md5_file( self ):
+ try:
+ # create a new md5 hash
+ m = md5.new( open( "addons.xml" ).read() ).hexdigest()
+ # save file
+ self._save_file( m, file="addons.xml.md5" )
+ except Exception, e:
+ # oops
+ print "An error occurred creating addons.xml.md5 file!\n%s" % ( e, )
+
+ def _save_file( self, data, file ):
+ try:
+ # write data to the file
+ open( file, "w" ).write( data )
+ except Exception, e:
+ # oops
+ print "An error occurred saving %s file!\n%s" % ( file, e, )
+
+
+if ( __name__ == "__main__" ):
+ # start
+ Generator()
View
BIN repo/script.video.parentalcontrols/script.video.parentalcontrols-1.4.zip
Binary file not shown.

0 comments on commit 9677057

Please sign in to comment.
Something went wrong with that request. Please try again.