The branch, eden-pre has been updated
       via  c35572902e91c52f4f5caa800a1392a6af258573 (commit)
      from  2f884749e5318a850a40d0cfc944763367d4e0b7 (commit)

- Log -----------------------------------------------------------------
http://xbmc.git.sourceforge.net/git/gitweb.cgi?p=xbmc/scripts;a=commit;h=c35572902e91c52f4f5caa800a1392a6af258573

commit c35572902e91c52f4f5caa800a1392a6af258573
Author: ronie <[email protected]>
Date:   Thu Oct 27 22:08:29 2011 +0200

    [script.artistslideshow] -v1.1.2
    
    added option for htbackdrops and additional artist info

diff --git a/script.artistslideshow/README.txt 
b/script.artistslideshow/README.txt
index 814ae73..c793e7b 100644
--- a/script.artistslideshow/README.txt
+++ b/script.artistslideshow/README.txt
@@ -1,3 +1,4 @@
+
 How to use this addon in your skin:
 
 
@@ -21,22 +22,44 @@ In MusicVisualisation.xml:
        <posy>0</posy>
        <width>1280</width>
        <height>720</height>
-       <imagepath 
background="true">$INFO[Window.Property(ArtistSlideshow)]</imagepath>
+       <imagepath 
background="true">$INFO[Window(Visualisation).Property(ArtistSlideshow)]</imagepath>
        <aspectratio>keep</aspectratio>
        <timeperimage>5000</timeperimage>
        <fadetime>2000</fadetime>
        <randomize>true</randomize>
        <animation effect="fade" start="0" end="100" 
time="300">Visible</animation>
        <animation effect="fade" start="100" end="0" 
time="300">Hidden</animation>
-       <visible>IsEmpty(Window.Property(ArtistSlideshowRefresh))</visible>
+       
<visible>IsEmpty(Window(Visualisation).Property(ArtistSlideshowRefresh))</visible>
 </control>
 
 
+You can also start this script at startup instead:
+- RunScript(script.artistslideshow,daemon=True)
+this will keep the script running all the time.
+
+
+The script provides these properties to the skin:
 
-The script provide two properties to the skin:
-- Window.Property(ArtistSlideshow) 
+- Window(Visualisation).Property(ArtistSlideshow)
 This is the path to the directory containing the downloaded images for the 
currently playing artist
-- Window.Property(ArtistSlideshowRefresh)
+
+- Window(Visualisation).Property(ArtistSlideshowRefresh)
 This can be used to fade out/fade in the slideshow when the path is refreshed.
 The path will refresh after all images for a certain artist have been 
downloaded.
-This is needed since xbmc will not automatically pick up any new images once 
the multiimage have been loaded.
+This is needed since xbmc will not automatically pick up any new images after 
the multiimage control has been loaded.
+
+- Window(Visualisation).Property(ArtistSlideshowRunning)
+This one is used internally by the script to check if it is already running.
+There's no need to use this property in your skin.
+
+- Window(Visualisation).Property(ArtistSlideshow.ArtistBiography)
+Artist biography from last.fm
+
+- Window(Visualisation).Property(ArtistSlideshow.%d.SimilarName)
+- Window(Visualisation).Property(ArtistSlideshow.%d.SimilarThumb)
+Similar artists
+
+- Window(Visualisation).Property(ArtistSlideshow.%d.AlbumName)
+- Window(Visualisation).Property(ArtistSlideshow.%d.AlbumThumb)
+Albums by the artist
+
diff --git a/script.artistslideshow/addon.xml b/script.artistslideshow/addon.xml
index 19173fe..6044755 100644
--- a/script.artistslideshow/addon.xml
+++ b/script.artistslideshow/addon.xml
@@ -1,15 +1,15 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.artistslideshow" name="Artist Slideshow" version="1.0.0" 
provider-name="ronie">
+<addon id="script.artistslideshow" name="Artist Slideshow" version="1.1.2" 
provider-name="ronie">
        <requires>
                <import addon="xbmc.python" version="2.0"/>
-               <import addon="script.module.beautifulsoup" version="3.2.0"/>
+               <import addon="script.module.elementtree" version="1.2.7"/>
        </requires>
        <extension point="xbmc.python.script" library="default.py">
                <provides>executable</provides>
        </extension>
        <extension point="xbmc.addon.metadata">
-               <summary>Download images of the currently playing artist from 
Last.FM</summary>
-               <description>Addon to downloads images from Last.FM of the 
currently playing artist. These images can be used by the skin to create a 
slideshow for the artist being listened to.</description>
+               <summary>Download images and additional info of the currently 
playing artist</summary>
+               <description>Addon to download images and additional 
information from Last.FM and htbackdrops.com of the currently playing artist. 
The images and info can be used by the skin to create a slideshow for the 
artist being listened to.</description>
                <platform>all</platform>
        </extension>
 </addon>
diff --git a/script.artistslideshow/changelog.txt 
b/script.artistslideshow/changelog.txt
index 4c3d372..b1937a3 100644
--- a/script.artistslideshow/changelog.txt
+++ b/script.artistslideshow/changelog.txt
@@ -1,3 +1,28 @@
+v1.1.2
+- added option to download additional artist info
+- use elementtree script module
+
+v1.1.1
+- added option to download images from htbackdrops.com
+
+v1.1.0
+- code refactoring
+
+v1.0.4
+- do not use the xbmc temp dir
+
+v1.0.3
+- allow the script to run without music playing
+
+v1.0.2
+- store images in addon_data
+
+v1.0.1
+- use xbmcvfs.mkdir
+
+v1.0.0
+- initial release
+
 v0.0.4 (beta 4)
 - added settings to specify minimal image width and height
 
diff --git a/script.artistslideshow/default.py 
b/script.artistslideshow/default.py
index 3e9bbf5..ca13007 100644
--- a/script.artistslideshow/default.py
+++ b/script.artistslideshow/default.py
@@ -6,181 +6,338 @@
 # *  code of both scripts is used in script.artistslideshow
 # *
 # *
-# *  Last.fm:  http://www.last.fm/
+# *  Last.fm:      http://www.last.fm/
+# *  htbackdrops:  http://www.htbackdrops.com/
 
-import urllib, urllib2, re, os, time
-import xbmc, xbmcgui, xbmcaddon
-from BeautifulSoup import BeautifulSoup
+import urllib, re, os, sys, time, unicodedata
+import xbmc, xbmcgui, xbmcaddon, xbmcvfs
+from elementtree import ElementTree as xmltree
 
-__settings__ = xbmcaddon.Addon( "script.artistslideshow" )
+__addon__        = xbmcaddon.Addon()
+__addonname__    = __addon__.getAddonInfo('id')
+__addonversion__ = __addon__.getAddonInfo('version')
 
 def log(txt):
     message = 'script.artistslideshow: %s' % txt
-    xbmc.log(msg=message, level=xbmc.LOGNOTICE)
+    xbmc.log(msg=message, level=xbmc.LOGDEBUG)
 
 def checkDir(path):
-    if not os.path.exists(path):
-        os.mkdir(path)
+    if not xbmcvfs.exists(path):
+        xbmcvfs.mkdir(path)
 
 def getCacheThumbName(url, CachePath):
     thumb = xbmc.getCacheThumbName(url)
+    thumbpath = os.path.join(CachePath, thumb)
+    return thumbpath
 
-    if 'jpg' in url:
-        thumb = thumb.replace('.tbn', '.jpg')
-    elif 'png' in url:
-        thumb = thumb.replace('.tbn', '.png')
-    elif 'gif' in url:
-        thumb = thumb.replace('.tbn', '.gif')
+def cleanText(text):
+    text = re.sub('<(.|\n|\r)*?>','',text)
+    text = re.sub('&quot;','"',text)
+    text = re.sub('&amp;','&',text)
+    text = re.sub('&gt;','>',text)
+    text = re.sub('&lt;','<',text)
+    text = re.sub('User-contributed text is available under the Creative 
Commons By-SA License and may also be available under the GNU FDL.','',text)
+    return text.strip()
+        
+def download(src, dst):
+    tmpname = xbmc.translatePath('special://profile/addon_data/%s/temp/%s' % ( 
__addonname__ , xbmc.getCacheThumbName(src) ))
+    if xbmcvfs.exists(tmpname):
+        xbmcvfs.delete(tmpname)
+    urllib.urlretrieve(src, tmpname)
+    if os.path.getsize(tmpname) > 999:
+        xbmcvfs.rename(tmpname, dst)
+    else:
+        xbmcvfs.delete(tmpname)
 
-    tpath = os.path.join(CachePath, thumb)
-    return tpath
+class Main:
+    def __init__( self ):
+        self._parse_argv()
+        self._get_settings()
+        self._init_vars()
+        self._make_dirs()
+        if xbmc.getInfoLabel( "Window(12006).Property(ArtistSlideshowRunning)" 
) == "True":
+            log('script already running')
+        else:
+            self.WINDOW.setProperty("ArtistSlideshowRunning", "True")
+            if xbmc.Player().isPlayingAudio() == False:
+                log('no music playing')
+                if self.DAEMON == "False":
+                    self.WINDOW.clearProperty("ArtistSlideshowRunning")
+            else:
+                log('first song started')
+                time.sleep(0.2) # it may take some time for xbmc to read tag 
info after playback started
+                self._start_download()
+            while (not xbmc.abortRequested):
+                time.sleep(0.5)
+                if xbmc.getInfoLabel( 
"Window(12006).Property(ArtistSlideshowRunning)" ) == "True":
+                    if xbmc.Player().isPlayingAudio() == True:
+                        currentname = 
xbmc.Player().getMusicInfoTag().getArtist()
+                        if self.NAME != currentname:
+                            log('new artist playing, start download')
+                            self._clear_properties()
+                            self._start_download()
+                        elif not self.DownloadedAllImages:
+                            log('same artist playing, continue download')
+                            self._start_download()
+                    else:
+                        time.sleep(1) # doublecheck if playback really stopped
+                        if xbmc.Player().isPlayingAudio() == False:
+                            if self.DAEMON == "False":
+                                
self.WINDOW.clearProperty("ArtistSlideshowRunning")
+                else:
+                    self._clear_properties()
+                    break
 
-def download(src, dst):
-    tmpname = xbmc.translatePath('special://temp/%s' % 
xbmc.getCacheThumbName(src))
+      
+    def _parse_argv( self ):
+        try:
+            params = dict( arg.split( "=" ) for arg in sys.argv[ 1 ].split( 
"&" ) )
+        except:
+            params = {}
+        self.DAEMON = params.get( "daemon", "False" )
+        if self.DAEMON == "True":
+            log('daemonizing')
 
-    if os.path.exists(tmpname):
-        os.remove(tmpname)
 
-    urllib.urlretrieve(src, filename = tmpname)
+    def _get_settings( self ):
+        try:
+            self.minwidth = int(__addon__.getSetting( "minwidth" ))
+        except:
+            self.minwidth = 0
+        try:
+            self.minheight = int(__addon__.getSetting( "minheight" ))
+        except:
+            self.minheight = 0
+        self.LASTFM = __addon__.getSetting( "lastfm" )
+        self.HTBACKDROPS = __addon__.getSetting( "htbackdrops" )
+        self.ARTISTINFO = __addon__.getSetting( "artistinfo" )
 
-    if os.path.getsize(tmpname) > 999:
-        os.rename(tmpname, dst)
-    else:
-        os.remove(tmpname)
-
-def startDownload(minwidth, minheight):
-    global name
-    global DownloadedAllImages
-    if xbmc.Player().isPlayingAudio() == False:
-        log('no music playing')
-        xbmcgui.Window( 12006 ).clearProperty("ArtistSlideshowRunning")
-        return
-    else:
-        name = xbmc.Player().getMusicInfoTag().getArtist()
-        if len(name) == 0:
+
+    def _init_vars( self ):
+        self.WINDOW = xbmcgui.Window( 12006 )
+        self.NAME = ''
+        LastfmApiKey = 'fbd57a1baddb983d1848a939665310f6'
+        HtbackdropsApiKey = '96d681ea0dcb07ad9d27a347e64b652a'
+        self.LastfmURL = 
'http://ws.audioscrobbler.com/2.0/?autocorrect=1&api_key=' + LastfmApiKey
+        self.HtbackdropsQueryURL = 'http://htbackdrops.com/api/' + 
HtbackdropsApiKey + '/searchXML?default_operator=and&fields=title&aid=1'
+        self.HtbackdropsDownloadURL = 'http://htbackdrops.com/api/' + 
HtbackdropsApiKey + '/download/'
+
+
+    def _make_dirs( self ):
+        checkDir(xbmc.translatePath('special://profile/addon_data/%s' % 
__addonname__ ))
+        checkDir(xbmc.translatePath('special://profile/addon_data/%s/temp' % 
__addonname__ ))
+        
checkDir(xbmc.translatePath('special://profile/addon_data/%s/ArtistSlideshow' % 
__addonname__ ))
+        
+
+    def _start_download( self ):
+        self.CachedImagesFound = False
+        self.DownloadedFirstImage = False
+        self.DownloadedAllImages = False
+        self.ImageDownloaded = False
+        self.NAME = xbmc.Player().getMusicInfoTag().getArtist()
+        if len(self.NAME) == 0:
             log('no artist name provided')
             return
-        song = xbmc.Player().getMusicInfoTag().getURL()
-        if len(song) == 0: # url may not be available for online radio
-            song = xbmc.Player().getMusicInfoTag().getTitle()
-        CacheName = xbmc.getCacheThumbName(name).replace('.tbn', '')
-        
checkDir(xbmc.translatePath('special://profile/Thumbnails/ArtistSlideshow'))
-        CacheDir = 
xbmc.translatePath('special://profile/Thumbnails/ArtistSlideshow/%s' % 
CacheName)
-        checkDir(CacheDir)
-        log('cachedir = %s' % CacheDir)
-        files = os.listdir(CacheDir)
-        CachedImagesFound = False
-        DownloadedFirstImage = False
-        DownloadedAllImages = False
-        ImageDownloaded = False
-
+        CacheName = xbmc.getCacheThumbName(self.NAME).replace('.tbn', '')
+        self.CacheDir = 
xbmc.translatePath('special://profile/addon_data/%s/ArtistSlideshow/%s/' % ( 
__addonname__ , CacheName, ))
+        checkDir(self.CacheDir)
+        log('cachedir = %s' % self.CacheDir)
+        files = os.listdir(self.CacheDir)
         for file in files:
-            if (file.endswith('jpg') or file.endswith('png') or 
file.endswith('gif') ):
-                CachedImagesFound = True
+            if file.endswith('tbn'):
+                self.CachedImagesFound = True
 
-        if CachedImagesFound:
+        if self.CachedImagesFound:
             log('cached images found')
-            xbmcgui.Window( 12006 ).setProperty("ArtistSlideshow", CacheDir)
+            self.WINDOW.setProperty("ArtistSlideshow", self.CacheDir)
+            if self.ARTISTINFO == "true":
+                self._get_artistinfo()
 
+        if self.LASTFM == "true":
+            lastfmlist = self._get_images('lastfm')
+        else:
+            lastfmlist = []
+
+        if self.HTBACKDROPS == "true":
+            htbackdropslist = self._get_images('htbackdrops')
+        else:
+            htbackdropslist = []
+
+        lastfmlist.extend(htbackdropslist)
         log('downloading images')
-        url = 
'http://ws.audioscrobbler.com/2.0/?method=artist.getimages&artist='+name.replace('&','%26').replace('
 ','+')+'&autocorrect=1&api_key=fbd57a1baddb983d1848a939665310f6'
-        req = urllib2.Request(url)
-        response = urllib2.urlopen(req)
-        link = response.read()
-        response.close()
-        soup = BeautifulSoup(link)
-        images = soup('image')
-
-        for image in images:
+        for url in lastfmlist:
             if xbmc.Player().isPlayingAudio() == True:
-                currentsong = xbmc.Player().getMusicInfoTag().getURL()
-                if len(currentsong) == 0:
-                    currentsong = xbmc.Player().getMusicInfoTag().getTitle()
-                if song != currentsong:
-                    log('new track started before download has finished')
+                currentname = xbmc.Player().getMusicInfoTag().getArtist()
+                if self.NAME != currentname:
                     return
-            url = image.size.string
-            size = image.size
-            height = int(size.get('height').replace('height ',''))
-            width = int(size.get('width').replace('width ',''))
-            path = getCacheThumbName(url, CacheDir)
-            if not os.path.exists(path):
-                if (width >= minwidth) and (height >= minheight):
-                    download(url, path)
-                    log('downloaded %s to %s' % (url, path) )
-                    ImageDownloaded=True
-            if ImageDownloaded:
-                if not DownloadedFirstImage:
+            else:
+                return
+
+            path = getCacheThumbName(url, self.CacheDir)
+            if not xbmcvfs.exists(path):
+                download(url, path)
+                log('downloaded %s to %s' % (url, path) )
+                self.ImageDownloaded=True
+            if self.ImageDownloaded:
+                if not self.DownloadedFirstImage:
                     log('downloaded first image')
-                    DownloadedFirstImage = True
-                if not CachedImagesFound:
-                    xbmcgui.Window( 12006 ).setProperty("ArtistSlideshow", 
CacheDir)
-
-        if ImageDownloaded:
-            log('finished downloaded images')
-            DownloadedAllImages = True
-            xbmcgui.Window( 12006 ).setProperty("ArtistSlideshowRefresh", 
"True")
-            time.sleep(0.3)
-            xbmcgui.Window( 12006 ).clearProperty("ArtistSlideshow")
-            time.sleep(0.05)
-            xbmcgui.Window( 12006 ).setProperty("ArtistSlideshow", CacheDir)
-            xbmcgui.Window( 12006 ).clearProperty("ArtistSlideshowRefresh")
-
-        if not ImageDownloaded:
+                    self.DownloadedFirstImage = True
+                    if not self.CachedImagesFound:
+                        self.WINDOW.setProperty("ArtistSlideshow", 
self.CacheDir)
+                        if self.ARTISTINFO == "true":
+                            self._get_artistinfo()
+
+        if self.ImageDownloaded:
+            log('finished downloading images')
+            self.DownloadedAllImages = True
+            self.WINDOW.setProperty("ArtistSlideshowRefresh", "True")
+            time.sleep(0.5)
+            self.WINDOW.clearProperty("ArtistSlideshow")
+            time.sleep(0.1)
+            self.WINDOW.setProperty("ArtistSlideshow", self.CacheDir)
+            self.WINDOW.clearProperty("ArtistSlideshowRefresh")
+
+        if not self.ImageDownloaded:
             log('no images downloaded')
-            DownloadedAllImages = True
-            if not CachedImagesFound:
-                xbmcgui.Window( 12006 ).clearProperty("ArtistSlideshow")
-
-def Start():
-    class MyPlayer( xbmc.Player ):
-        def __init__ ( self ):
-            xbmc.Player.__init__( self )
-            self.minwidth = int(__settings__.getSetting( "minwidth" ))
-            self.minheight = int(__settings__.getSetting( "minheight" ))
-            log('first song started')
-            xbmc.sleep(200) # it may take some time for xbmc to read tag info 
after playback started
-            startDownload( self.minwidth , self.minheight )
-            while (True):
-                if xbmc.getInfoLabel( 
"Window(12006).Property(ArtistSlideshowRunning)" ) == "True":
-                    xbmc.sleep(1000)
-                else:
-                    xbmcgui.Window( 12006 ).clearProperty("ArtistSlideshow")
-                    xbmcgui.Window( 12006 
).clearProperty("ArtistSlideshowRefresh")
-                    break
+            self.DownloadedAllImages = True
+            if not self.CachedImagesFound:
+                self.WINDOW.clearProperty("ArtistSlideshow")
+                if self.ARTISTINFO == "true":
+                    self._get_artistinfo()
 
-        def onPlayBackStarted( self ):
-            log('next song started')
-            xbmc.sleep(200) # it may take some time for xbmc to read tag info 
after playback started
-            if xbmc.Player().isPlayingAudio() == True:
-                currentname = xbmc.Player().getMusicInfoTag().getArtist()
-                if name != currentname:
-                    log('new artist playing, start download')
-                    startDownload( self.minwidth , self.minheight )
-                elif not DownloadedAllImages:
-                    log('same artist playing, continue download')
-                    startDownload( self.minwidth , self.minheight )
-                else:
-                    log('same artist playing, no need to download')
-
-        def onPlayBackStopped( self ):
-            xbmc.sleep(1000)
-            if not self.isPlayingAudio():
-                log('playback stopped')
-                xbmcgui.Window( 12006 ).clearProperty("ArtistSlideshowRunning")
-
-        def onPlayBackEnded( self ):
-            xbmc.sleep(1000)
-            if not self.isPlayingAudio():
-                log('playback ended')
-                xbmcgui.Window( 12006 ).clearProperty("ArtistSlideshowRunning")
-
-    MyPlayer()
-
-log('script started')
-if xbmc.getInfoLabel( "Window(12006).Property(ArtistSlideshowRunning)" ) == 
"True":
-    log('script already running')
-if not xbmc.getInfoLabel( "Window(12006).Property(ArtistSlideshowRunning)" ) 
== "True":
-    xbmcgui.Window( 12006 ).setProperty("ArtistSlideshowRunning", "True")
-    Start()
+
+    def _get_images( self, site ):
+        if site == "lastfm":
+            self.info = 'artist.getImages'
+            self.url = self.LastfmURL + '&method=artist.getImages&artist=' + 
self.NAME.replace('&','%26').replace(' ','+')
+        elif site == "htbackdrops":
+            self.url = self.HtbackdropsQueryURL + '&keywords=' + 
self.NAME.replace('&','%26').replace(' ','+') + '&dmin_w=' + str( self.minwidth 
) + '&dmin_h=' + str( self.minheight )
+        images = self._get_data(site, 'images')
+        return images
+
+
+    def _get_artistinfo( self ):
+        site = "lastfm"
+        self.url = self.LastfmURL + '&method=artist.getInfo&artist=' + 
self.NAME.replace('&','%26').replace(' ','+')
+        bio = self._get_data(site, 'bio')
+        if bio == []:
+            self.biography = ''
+        else:
+            self.biography = cleanText(bio[0])
+        self.url = self.LastfmURL + '&method=artist.getSimilar&artist=' + 
self.NAME.replace('&','%26').replace(' ','+')
+        self.similar = self._get_data(site, 'similar')
+        self.url = self.LastfmURL + '&method=artist.getTopAlbums&artist=' + 
self.NAME.replace('&','%26').replace(' ','+')
+        self.albums = self._get_data(site, 'albums')
+        self._set_properties()
+
+
+    def _get_data( self, site, item ):
+        data = []
+        match = ''
+        ForceUpdate = True
+        if item == "images":
+            if site == "lastfm":
+                filename = os.path.join( self.CacheDir, 
'artistimageslastfm.nfo')
+            elif site == "htbackdrops":
+                filename = os.path.join( self.CacheDir, 
'artistimageshtbackdrops.nfo')
+        elif item == "bio":
+            filename = os.path.join( self.CacheDir, 'artistbio.nfo')
+        elif item == "similar":
+            filename = os.path.join( self.CacheDir, 'artistsimilar.nfo')
+        elif item == "albums":
+            filename = os.path.join( self.CacheDir, 'artistsalbums.nfo')
+        if xbmcvfs.exists( filename ):
+            if time.time() - os.path.getmtime(filename) < 1209600:
+                log('cached artist %s info found' % item)
+                ForceUpdate = False
+            else:
+                log('outdated cached artist %s info found' % item)
+        elif ForceUpdate:
+            log('downloading artist %s info %s' % (item, site))
+            try:
+                urllib.urlretrieve( self.url, filename )
+            except:
+                log('site unreachable')
+                return data
+        try:
+            xmldata = xmltree.parse(filename).getroot()
+        except:
+            log('invalid xml file')
+            xbmcvfs.delete(filename)
+            return data
+        if item == "images":
+            for element in xmldata.getiterator():
+                if site == "lastfm":
+                    if element.tag == "size":
+                        if element.attrib.get('name') == "original":
+                            width = element.attrib.get('width')
+                            height = element.attrib.get('height')
+                            if ( int(width) >= self.minwidth ) and ( 
int(height) >= self.minheight ):
+                                data.append(element.text)
+                elif site == "htbackdrops":
+                    if element.tag == "id":
+                        data.append(self.HtbackdropsDownloadURL + str( 
element.text ) + '/fullsize')
+        elif item == "bio":
+            for element in xmldata.getiterator():
+                if element.tag == "content":
+                    bio = element.text
+                    if not bio:
+                        bio = ''
+                    data.append(bio)
+        elif item == "similar":
+            for element in xmldata.getiterator():
+                if element.tag == "name":
+                    name = element.text
+                    name.encode('ascii', 'ignore')
+                elif element.tag == "image":
+                    if element.attrib.get('size') == "mega":
+                        image = element.text
+                        if not image:
+                            image = ''
+                        data.append( ( name , image ) )
+        elif item == "albums":
+            for element in xmldata.getiterator():
+                if element.tag == "name":
+                    if match:
+                        match = ''
+                    else:
+                        name = element.text
+                        name.encode('ascii', 'ignore')
+                        match = 'true'
+                elif element.tag == "image":
+                    if element.attrib.get('size') == "extralarge":
+                        image = element.text
+                        if not image:
+                            image = ''
+                        data.append( ( name , image ) )
+        if data == '':
+            log('no %s found on %s' % (item, site))
+        return data
+
+
+    def _set_properties( self ):
+        self.WINDOW.setProperty("ArtistSlideshow.ArtistBiography", 
self.biography)
+        for count, item in enumerate( self.similar ):
+            self.WINDOW.setProperty("ArtistSlideshow.%d.SimilarName" % ( count 
+ 1 ), item[0])
+            self.WINDOW.setProperty("ArtistSlideshow.%d.SimilarThumb" % ( 
count + 1 ), item[1])
+        for count, item in enumerate( self.albums ):
+            self.WINDOW.setProperty("ArtistSlideshow.%d.AlbumName" % ( count + 
1 ), item[0])
+            self.WINDOW.setProperty("ArtistSlideshow.%d.AlbumThumb" % ( count 
+ 1 ), item[1])
+
+
+    def _clear_properties( self ):
+        if not xbmc.getInfoLabel( 
"Window(12006).Property(ArtistSlideshowRunning)" ) == "True":
+            self.WINDOW.clearProperty("ArtistSlideshow")
+            self.WINDOW.clearProperty("ArtistSlideshowRefresh")
+        self.WINDOW.clearProperty( "ArtistSlideshow.ArtistBiography" )
+        for count in range( 50 ):
+            self.WINDOW.clearProperty( "ArtistSlideshow.%d.SimilarName" % ( 
count ) )
+            self.WINDOW.clearProperty( "ArtistSlideshow.%d.SimilarThumb" % ( 
count ) )
+            self.WINDOW.clearProperty( "ArtistSlideshow.%d.AlbumName" % ( 
count ) )
+            self.WINDOW.clearProperty( "ArtistSlideshow.%d.AlbumThumb" % ( 
count ) )
+
+
+if ( __name__ == "__main__" ):
+        log('script version %s started' % __addonversion__)
+        Main()
 log('script stopped')
diff --git a/script.artistslideshow/resources/language/English/strings.xml 
b/script.artistslideshow/resources/language/English/strings.xml
index 0b13e44..1ec3a6c 100644
--- a/script.artistslideshow/resources/language/English/strings.xml
+++ b/script.artistslideshow/resources/language/English/strings.xml
@@ -1,6 +1,9 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <strings>
        <string id="32000">General</string>
-       <string id="32001">Minimal image width</string>
-       <string id="32002">Minimal image height</string>
+       <string id="32001">Download images from last.fm</string>
+       <string id="32002">Download images from htbackdrops.com</string>
+       <string id="32003">Minimal image width</string>
+       <string id="32004">Minimal image height</string>
+       <string id="32005">Download additional artist information</string>
 </strings>
diff --git a/script.artistslideshow/resources/settings.xml 
b/script.artistslideshow/resources/settings.xml
index 954a005..e66ff9d 100644
--- a/script.artistslideshow/resources/settings.xml
+++ b/script.artistslideshow/resources/settings.xml
@@ -1,7 +1,10 @@
 <?xml version="1.0" encoding="utf-8" standalone="yes"?>
 <settings>
     <category label="30100">
-       <setting id="minwidth" type="text" label="32001" default="0"/>
-       <setting id="minheight" type="text" label="32002" default="0"/>
+       <setting id="lastfm" type="bool" label="32001" default="true"/>
+       <setting id="htbackdrops" type="bool" label="32002" default="fasle"/>
+       <setting id="minwidth" type="text" label="32003" default="0"/>
+       <setting id="minheight" type="text" label="32004" default="0"/>
+       <setting id="artistinfo" type="bool" label="32005" default="fasle"/>
     </category>
 </settings>

-----------------------------------------------------------------------

Summary of changes:
 script.artistslideshow/README.txt                  |   35 ++-
 script.artistslideshow/addon.xml                   |    8 +-
 script.artistslideshow/changelog.txt               |   25 ++
 script.artistslideshow/default.py                  |  455 +++++++++++++-------
 .../resources/language/English/strings.xml         |    7 +-
 script.artistslideshow/resources/settings.xml      |    7 +-
 6 files changed, 374 insertions(+), 163 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
The demand for IT networking professionals continues to grow, and the
demand for specialized networking skills is growing even more rapidly.
Take a complimentary Learning@Cisco Self-Assessment and learn 
about Cisco certifications, training, and career opportunities. 
http://p.sf.net/sfu/cisco-dev2dev
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to