Revision: 2275
Author:
nuka...@gmail.com
Date: Tue May 1 13:16:46 2012
Log: [addons_xml_generator.py]
-changed: updated for python 2.6
-added: check for malformed addon.xml files
-updated: addons.xml and addons.xml.md5
http://code.google.com/p/xbmc-addons/source/detail?r=2275
Modified:
/addons/addons.xml
/addons/addons.xml.md5
/addons/addons_xml_generator.py
=======================================
--- /addons/addons.xml Thu Jan 26 13:23:52 2012
+++ /addons/addons.xml Tue May 1 13:16:46 2012
@@ -1,19 +1,42 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<addons>
-<addon id="repository.googlecode.xbmc-addons" name="googlecode.xbmc-addons
Add-ons" version="1.0.1" provider-name="nuka1195">
- <extension point="xbmc.addon.repository" name="googlecode.xbmc-addons
Add-on Repository">
- <info
compressed="false">
http://xbmc-addons.googlecode.com/svn/addons/addons.xml</info>
-
<checksum>
http://xbmc-addons.googlecode.com/svn/addons/addons.xml.md5</checksum>
- <datadir
zip="false">
http://xbmc-addons.googlecode.com/svn/addons</datadir>
- </extension>
- <extension point="xbmc.addon.metadata">
- <summary>Install Add-ons from googlecode.xbmc-addons</summary>
- <description>Download and install add-ons from googlecode.xbmc-addons
addon repository.[CR][CR]By using this Repository you will be able to take
advantage of our cutting edge features.</description>
- <disclaimer>Nuka1195 did not make all the add-ons on this repository and
is not responsible for their content</disclaimer>
- <platform>all</platform>
- </extension>
+<addon
+ id="plugin.audio.listenliveeu"
+ version="0.4.3"
+ name="ListenLiveEU"
+ provider-name="bootsy [
boot...@gmail.com]">
+ <requires>
+ <import addon="xbmc.python" version="1.0"/>
+ </requires>
+ <extension
+ point="xbmc.python.pluginsource"
+ library="default.py">
+ <provides>audio</provides>
+ </extension>
+ <extension point="xbmc.addon.metadata">
+ <summary lang="en">European radio stations streaming live on the
internet</summary>
+ <summary lang="hu">Európai internetes rádiók</summary>
+ <description lang="en">Welcome to
listenlive.eu, a web radio directory
showcasing over 4000 radio stations from across Europe streaming live on
the internet.</description>
+ <description lang="hu">A
listenlive.eu több mint 4000 élo rádióadást
tartalmaz Európából, melyeket az interneten keresztül érhetsz
el.</description>
+ <platform>all</platform>
+ </extension>
</addon>
+<addon id="plugin.video.apple.movie.trailers.lite" name="Apple Movie
Trailers - Lite" version="2.0.1" provider-name="nuka1195">
+ <requires>
+ <import addon="xbmc.python" version="1.0"/>
+ </requires>
+ <extension point="xbmc.python.pluginsource" library="addon.py">
+ <provides>video</provides>
+ </extension>
+ <extension point="xbmc.addon.metadata">
+ <platform>all</platform>
+ <summary>Watch current movie trailers from
apple.com.</summary>
+ <disclaimer>Only the most recent 100 or so trailers are
listed.</disclaimer>
+ <description>Watch current movie trailers from
http://trailers.apple.com/.[CR][CR]Check movie showtimes for theaters in
your area.</description>
+ </extension>
+</addon>
+
<addon id="plugin.video.cnn.video" name="CNN Video" version="2.0.5"
provider-name="nuka1195">
<requires>
<import addon="xbmc.python" version="1.0"/>
@@ -32,41 +55,44 @@
</extension>
</addon>
-<addon
- id="plugin.video.videomonkey"
- version="1.4.2"
- name="VideoMonkey"
- provider-name="sfaxman / bootsy">
+<addon id="plugin.video.karaokeplay"
+ name="KaraokePlay"
+ version="1.0"
+ provider-name="dagur">
<requires>
- <import addon="xbmc.python" version="1.0"/>
+ <import addon="xbmc.python" version="1.0"/>
+ <import addon="script.module.beautifulsoup" version="3.0.8"/>
+ <import addon="
plugin.video.youtube" version="1.8.1"/>
</requires>
- <extension
- point="xbmc.python.pluginsource"
- library="default.py">
- <provides>video</provides>
+ <extension point="xbmc.python.pluginsource"
+ library="default.py">
+ <provides>audio video</provides>
</extension>
<extension point="xbmc.addon.metadata">
- <summary>Stream videos from different sites</summary>
- <description>Stream videos from YouTube, Clipfish, Kino.de,
Computerclub², ARD & ZDF Mediathek, 3sat, Schweizer Fernsehen etc. Also
live channels from different regions (DE, EN, FR, NL, SE, SP, THA, VN) and
categories (kids, sports, music) are supported.</description>
+ <summary lang="en">Play Karaoke videos from KaraokePlay.com</summary>
+ <description lang="en">KaraokePlay has thousands of karaoke videos
from youtube indexed. This allows you to browse and play them from
xbmc.</description>
<platform>all</platform>
</extension>
</addon>
-<addon id="script.module.xbmcaddon" name="xbmcaddon emulator"
version="1.0.4" provider-name="nuka1195">
+<addon id="plugin.video.nos.journaal" name="NOS Journaal" version="0.3"
provider-name="Frank Spierings">
<requires>
<import addon="xbmc.python" version="1.0"/>
</requires>
- <extension point="xbmc.python.module" library="lib"/>
+ <extension point="xbmc.python.pluginsource" library="default.py">
+ <provides>video</provides>
+ </extension>
<extension point="xbmc.addon.metadata">
- <platform>xbox</platform>
- <summary lang="en">Module emulates XBMC xbmcaddon module.</summary>
- <description lang="en">Module emulates XBMC xbmcaddon
module.</description>
+ <platform>all</platform>
+ <summary>Stream NOS Journaal (
www.nos.nl)</summary>
+ <disclaimer></disclaimer>
+ <description>Stream NOS Journaal (
www.nos.nl)</description>
</extension>
</addon>
<addon id="plugin.video.sarpur"
name="Sarpur"
- version="1.0"
+ version="1.0.1"
provider-name="dagur">
<requires>
<import addon="xbmc.python" version="1.0"/>
@@ -79,11 +105,63 @@
</extension>
<extension point="xbmc.addon.metadata">
<summary lang="en">Play videos and radio recordings from the Icelandic
National Radio's website</summary>
- <description lang="en">An Iceland IP-Address is required to use this
because
ruv.is locks all other out</description>
+ <description lang="en">An Iceland IP-Address is required to use this
because of geoblocking</description>
<platform>all</platform>
</extension>
</addon>
+<addon
+ id="plugin.video.videomonkey"
+ version="1.4.2"
+ name="VideoMonkey"
+ provider-name="sfaxman / bootsy">
+ <requires>
+ <import addon="xbmc.python" version="1.0"/>
+ </requires>
+ <extension
+ point="xbmc.python.pluginsource"
+ library="default.py">
+ <provides>video</provides>
+ </extension>
+ <extension point="xbmc.addon.metadata">
+ <summary>Stream videos from different sites</summary>
+ <description>Stream videos from YouTube, Clipfish, Kino.de,
Computerclub², ARD & ZDF Mediathek, 3sat, Schweizer Fernsehen etc. Also
live channels from different regions (DE, EN, FR, NL, SE, SP, THA, VN) and
categories (kids, sports, music) are supported.</description>
+ <platform>all</platform>
+ </extension>
+</addon>
+
+<addon id="repository.googlecode.xbmc-addons" name="googlecode.xbmc-addons
Add-ons" version="1.0.1" provider-name="nuka1195">
+ <extension point="xbmc.addon.repository" name="googlecode.xbmc-addons
Add-on Repository">
+ <info
compressed="false">
http://xbmc-addons.googlecode.com/svn/addons/addons.xml</info>
+
<checksum>
http://xbmc-addons.googlecode.com/svn/addons/addons.xml.md5</checksum>
+ <datadir
zip="false">
http://xbmc-addons.googlecode.com/svn/addons</datadir>
+ </extension>
+ <extension point="xbmc.addon.metadata">
+ <summary>Install Add-ons from googlecode.xbmc-addons</summary>
+ <description>Download and install add-ons from googlecode.xbmc-addons
addon repository.[CR][CR]By using this Repository you will be able to take
advantage of our cutting edge features.</description>
+ <disclaimer>Nuka1195 did not make all the add-ons on this repository and
is not responsible for their content</disclaimer>
+ <platform>all</platform>
+ </extension>
+</addon>
+
+<addon id="script.apple.movie.trailers" name="Apple Movie Trailers"
version="2.0.0" provider-name="nuka1195">
+ <requires>
+ <import addon="xbmc.python" version="1.0"/>
+ <import addon="script.module.pysqlite" version="2.5.6"/>
+ <import addon="script.module.elementtree" version="1.2.7"/>
+ <import addon="script.module.pil" version="1.1.7"/>
+ </requires>
+ <extension point="xbmc.python.script" library="addon.py">
+ <provides>video</provides>
+ </extension>
+ <extension point="xbmc.addon.metadata">
+ <platform>all</platform>
+ <summary>Watch movie trailers.</summary>
+ <disclaimer></disclaimer>
+ <description>Watch movie trailers from
http://trailers.apple.com/.
Check movie showtimes for theaters in your area.</description>
+ </extension>
+</addon>
+
<addon id="script.cinema.experience" name="Cinema Experience"
version="1.0.46" provider-name="nuka1195-giftie-ackbarr">
<requires>
<import addon="xbmc.python" version="1.0"/>
@@ -99,6 +177,18 @@
</extension>
</addon>
+<addon id="script.module.xbmcaddon" name="xbmcaddon emulator"
version="1.0.4" provider-name="nuka1195">
+ <requires>
+ <import addon="xbmc.python" version="1.0"/>
+ </requires>
+ <extension point="xbmc.python.module" library="lib"/>
+ <extension point="xbmc.addon.metadata">
+ <platform>xbox</platform>
+ <summary lang="en">Module emulates XBMC xbmcaddon module.</summary>
+ <description lang="en">Module emulates XBMC xbmcaddon
module.</description>
+ </extension>
+</addon>
+
<addon id="script.pydocs" name="PyDocs Printer" version="2.0.5"
provider-name="nuka1195">
<requires>
<import addon="xbmc.python" version="1.0"/>
@@ -134,61 +224,6 @@
</extension>
</addon>
-<addon id="script.apple.movie.trailers" name="Apple Movie Trailers"
version="2.0.0" provider-name="nuka1195">
- <requires>
- <import addon="xbmc.python" version="1.0"/>
- <import addon="script.module.pysqlite" version="2.5.6"/>
- <import addon="script.module.elementtree" version="1.2.7"/>
- <import addon="script.module.pil" version="1.1.7"/>
- </requires>
- <extension point="xbmc.python.script" library="addon.py">
- <provides>video</provides>
- </extension>
- <extension point="xbmc.addon.metadata">
- <platform>all</platform>
- <summary>Watch movie trailers.</summary>
- <disclaimer></disclaimer>
- <description>Watch movie trailers from
http://trailers.apple.com/.
Check movie showtimes for theaters in your area.</description>
- </extension>
-</addon>
-
-<addon id="plugin.video.apple.movie.trailers.lite" name="Apple Movie
Trailers - Lite" version="2.0.1" provider-name="nuka1195">
- <requires>
- <import addon="xbmc.python" version="1.0"/>
- </requires>
- <extension point="xbmc.python.pluginsource" library="addon.py">
- <provides>video</provides>
- </extension>
- <extension point="xbmc.addon.metadata">
- <platform>all</platform>
- <summary>Watch current movie trailers from
apple.com.</summary>
- <disclaimer>Only the most recent 100 or so trailers are
listed.</disclaimer>
- <description>Watch current movie trailers from
http://trailers.apple.com/.[CR][CR]Check movie showtimes for theaters in
your area.</description>
- </extension>
-</addon>
-
-<addon
- id="plugin.audio.listenliveeu"
- version="0.4.3"
- name="ListenLiveEU"
- provider-name="bootsy [
boot...@gmail.com]">
- <requires>
- <import addon="xbmc.python" version="1.0"/>
- </requires>
- <extension
- point="xbmc.python.pluginsource"
- library="default.py">
- <provides>audio</provides>
- </extension>
- <extension point="xbmc.addon.metadata">
- <summary lang="en">European radio stations streaming live on the
internet</summary>
- <summary lang="hu">Európai internetes rádiók</summary>
- <description lang="en">Welcome to
listenlive.eu, a web radio directory
showcasing over 4000 radio stations from across Europe streaming live on
the internet.</description>
- <description lang="hu">A
listenlive.eu több mint 4000 élo rádióadást
tartalmaz Európából, melyeket az interneten keresztül érhetsz
el.</description>
- <platform>all</platform>
- </extension>
-</addon>
-
<addon id="weather.weatherplus"
name="Weather Plus"
version="2.5.0"
@@ -203,39 +238,4 @@
<platform>all</platform>
</extension>
</addon>
-
-<addon id="plugin.video.nos.journaal" name="NOS Journaal" version="0.3"
provider-name="Frank Spierings">
- <requires>
- <import addon="xbmc.python" version="1.0"/>
- </requires>
- <extension point="xbmc.python.pluginsource" library="default.py">
- <provides>video</provides>
- </extension>
- <extension point="xbmc.addon.metadata">
- <platform>all</platform>
- <summary>Stream NOS Journaal (
www.nos.nl)</summary>
- <disclaimer></disclaimer>
- <description>Stream NOS Journaal (
www.nos.nl)</description>
- </extension>
-</addon>
-
-<addon id="plugin.video.karaokeplay"
- name="KaraokePlay"
- version="1.0"
- provider-name="dagur">
- <requires>
- <import addon="xbmc.python" version="1.0"/>
- <import addon="script.module.beautifulsoup" version="3.0.8"/>
- <import addon="
plugin.video.youtube" version="1.8.1"/>
- </requires>
- <extension point="xbmc.python.pluginsource"
- library="default.py">
- <provides>audio video</provides>
- </extension>
- <extension point="xbmc.addon.metadata">
- <summary lang="en">Play Karaoke videos from KaraokePlay.com</summary>
- <description lang="en">KaraokePlay has thousands of karaoke videos
from youtube indexed. This allows you to browse and play them from
xbmc.</description>
- <platform>all</platform>
- </extension>
-</addon>
</addons>
=======================================
--- /addons/addons.xml.md5 Thu Jan 26 13:23:52 2012
+++ /addons/addons.xml.md5 Tue May 1 13:16:46 2012
@@ -1,1 +1,1 @@
-8f8c8b4e2f6df5130a0b1481e8d5a44f
+36626d10e338b072b6e52de6053ecb31
=======================================
--- /addons/addons_xml_generator.py Sat Nov 13 08:37:10 2010
+++ /addons/addons_xml_generator.py Tue May 1 13:16:46 2012
@@ -1,7 +1,9 @@
-""" addons.xml generator """
-
+## repo addons.xml and addons.xml.md5 generator
+
+from xml.dom.minidom import parseString
+import hashlib
import os
-import md5
+import sys
class Generator:
@@ -10,64 +12,78 @@
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
+ # generate addons.xml file
+ if ( not self._generate_addons_xml_file() ):
+ sys.exit( 0 )
+ # generate addons.xml.md5 file
+ if ( not self._generate_addons_xml_md5_file() ):
+ sys.exit( 0 )
+ # notify user of successfully updating files
+ print "Finished updating addons.xml and addons.xml.md5 files!"
+
+ def _generate_addons_xml_file( self ):
+ # addons.xml heading block
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:
+ # list of only folders, skip special .svn folder
+ folders = [ f for f in os.listdir( os.curdir )
+ if ( os.path.isdir( f ) and f != ".svn" ) ]
+ # loop thru and add each addons addon.xml to the final addons.xml
file
+ for folder in folders:
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" )
+ # new addon.xml text holder
+ addon_xml = u""
+ # create full path to an addon.xml file
+ _path = os.path.join( folder, "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" )
+ with open( _path, "r" ) as addon_file:
+ # loop thru cleaning each line
+ for line in addon_file:
+ # skip heading block as we already have one
+ if ( line.find( "<?xml" ) >= 0 ): continue
+ # add line
+ addon_xml += unicode( line.rstrip()
+ "\n", "UTF-8" )
+ # check for a properly formatted xml file
+ parseString( addon_xml.encode( "UTF-8" ) )
+ except Exception as e:
+ # missing or malformed formatted addon.xml
+ print "* Excluding {path} for {error}".format( path=_path,
error=e )
+ else:
# 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 ):
+ # save file and return result
+ return self._save_file( data=addons_xml.encode( "UTF-8" ),
file="addons.xml" )
+
+ def _generate_addons_xml_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:
+ md5 = hashlib.md5( open( "addons.xml" ).read() ).hexdigest()
+ except IOError as e:
# oops
- print "An error occurred creating addons.xml.md5 file!\n%s" %
( e, )
+ print "An error occurred creating md5 hash from addons.xml
file!\n{error}".format( error=e )
+ # return failed
+ return False
+ else:
+ # save file
+ return self._save_file( data=md5, file="addons.xml.md5" )
def _save_file( self, data, file ):
try:
# write data to the file
open( file, "w" ).write( data )
- except Exception, e:
+ except IOError as e:
# oops
- print "An error occurred saving %s file!\n%s" % ( file, e, )
+ print "An error occurred saving {file} file!\n{error}".format(
file=file, error=e )
+ # return failed
+ return False
+ else:
+ # return success
+ return True
+# start
if ( __name__ == "__main__" ):
- # start
Generator()