The branch, eden has been updated
       via  93f1b4c81df783ba5b79064b2ba4abff67222a79 (commit)
      from  ce97676dfe600eb01de68459cbcdb14ebb1c4c80 (commit)

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

commit 93f1b4c81df783ba5b79064b2ba4abff67222a79
Author: amet <[email protected]>
Date:   Fri Aug 17 21:59:42 2012 +0400

    [script.artistslideshow] -v 1.4.2
    
    - updated featured artist parsing to support radio streams
    - updated featured artist parsing to support calls from external scripts
    - updated the notifications logic when downloading images
    - added notification if no images downloaded
    - added notification when all downloads complete
    - added ability to override artist bio, albums, and similar artists with 
local info
    - fixed bug when using both local and remote images
    - added French localization strings and description (thanks to mikebzh44)
    - updated Portuguese-Brazil strings (thanks to Wanilton)
    - UTF8 encoded message strings

diff --git a/script.artistslideshow/addon.xml b/script.artistslideshow/addon.xml
index 0e87dad..55bd58d 100644
--- a/script.artistslideshow/addon.xml
+++ b/script.artistslideshow/addon.xml
@@ -1,5 +1,5 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
-<addon id="script.artistslideshow" name="Artist Slideshow" version="1.4.1" 
provider-name="ronie/kyleejohnson (pkscuot)">
+<addon id="script.artistslideshow" name="Artist Slideshow" version="1.4.2" 
provider-name="ronie/kyleejohnson (pkscuot)">
        <requires>
                <import addon="xbmc.python" version="2.0"/>
                <import addon="script.module.elementtree" version="1.2.7"/>
@@ -10,6 +10,8 @@
        <extension point="xbmc.addon.metadata">
                <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, along with local artists' images, and info can be used by the skin 
to create a slideshow for the artist being listened to.</description>
+               <summary lang="fr">Télécharger les images et les informations 
additionnelles de l'artiste en cours de lecture</summary>
+               <description lang="fr">Cett addon permet de télécharger les 
images et les informations additionnelles depuis Last.FM et htbackdrops.com de 
l'artiste en cours de lecture. Les images, ainsi que les images locales, et les 
informations peuvent être utilisées par le thème pour créer un diaporama 
pour l'artiste que vous êtes en train d'écouter.</description>
                <platform>all</platform>
                <language>sq ar be bg ca zh hr cs da nl en et fi fr de el iw hi 
hu is in it ja ko lv lt mk no pl pt ro ru sr sk sl es sv th tr uk vi</language>
        </extension>
diff --git a/script.artistslideshow/changelog.txt 
b/script.artistslideshow/changelog.txt
index 9303b3c..3167524 100644
--- a/script.artistslideshow/changelog.txt
+++ b/script.artistslideshow/changelog.txt
@@ -1,3 +1,15 @@
+v.1.4.2
+- updated featured artist parsing to support radio streams
+- updated featured artist parsing to support calls from external scripts
+- updated the notifications logic when downloading images
+- added notification if no images downloaded
+- added notification when all downloads complete
+- added ability to override artist bio, albums, and similar artists with local 
info
+- fixed bug when using both local and remote images
+- added French localization strings and description (thanks to mikebzh44)
+- updated Portuguese-Brazil strings (thanks to Wanilton)
+- UTF8 encoded message strings
+
 v.1.4.1
 - updated language files for Portuguese-Brazil (thanks to Wanilton)
 - fixed error causing information for 50th album to not be cleared
diff --git a/script.artistslideshow/default.py 
b/script.artistslideshow/default.py
index ba4c216..c564c19 100644
--- a/script.artistslideshow/default.py
+++ b/script.artistslideshow/default.py
@@ -95,12 +95,15 @@ def cleanText(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, dst2):
+def download(src, dst, dst2, display_dialog):
     if (not xbmc.abortRequested):
         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)
+        global __last_time__
+        # __last_time__ = 0
+        # urllib.urlretrieve( src, tmpname, lambda nb, bs, fs: reporthook(nb, 
bs, fs, display_dialog) )
+        urllib.urlretrieve( src, tmpname )
         if os.path.getsize(tmpname) > 999:
             log( 'copying file to transition directory' )
             xbmcvfs.copy(tmpname, dst2)
@@ -109,6 +112,12 @@ def download(src, dst, dst2):
         else:
             xbmcvfs.delete(tmpname)
 
+def reporthook( numblocks, blocksize, filesize, display_dialog ):
+    if time.time() - __last_time__ > 3 and display_dialog:
+        xbmc.executebuiltin('XBMC.Notification("' + 
__language__(30300).encode("utf8") + '", "' + 
__language__(30301).encode("utf8") + '", 20000, ' + __addonicon__ + ')')
+        global __last_time__
+        __last_time__ = time.time()
+
 class Main:
     def __init__( self ):
         self._parse_argv()
@@ -201,6 +210,8 @@ class Main:
         log( 'window id is set to %s' % self.WINDOWID )
         self.ARTISTFIELD = params.get( "artistfield", "" )
         log( 'artist field is set to %s' % self.ARTISTFIELD )
+        self.TITLEFIELD = params.get( "titlefield", "" )
+        log( 'title field is set to %s' % self.TITLEFIELD )
         self.DAEMON = params.get( "daemon", "False" )
         if self.DAEMON == "True":
             log('daemonizing')
@@ -253,6 +264,10 @@ class Main:
             self.SKINARTIST = ''
         else:
             self.SKINARTIST = "Window(%s).Property(%s)" % ( self.WINDOWID, 
self.ARTISTFIELD )
+        if( self.TITLEFIELD == '' ):
+            self.SKINTITLE = ''
+        else:
+            self.SKINTITLE = "Window(%s).Property(%s)" % ( self.WINDOWID, 
self.TITLEFIELD )
         self.ARTISTSLIDESHOW = "Window(%s).Property(%s)" % ( self.WINDOWID, 
"ArtistSlideshow" )
         self.ARTISTSLIDESHOWRUNNING = "Window(%s).Property(%s)" % ( 
self.WINDOWID, "ArtistSlideshowRunning" )
         self.EXTERNALCALL = "Window(%s).Property(%s)" % ( self.WINDOWID, 
"ArtistSlideshow.ExternalCall" )
@@ -288,6 +303,8 @@ class Main:
         self.DownloadedAllImages = False
         self.ImageDownloaded = False
         self.FirstImage = True
+        show_progress = True
+        display_dialog = False
         min_refresh = 9.9
         if len(self.NAME) == 0:
             log('no artist name provided')
@@ -303,7 +320,7 @@ class Main:
 
         files = os.listdir(self.CacheDir)
         for file in files:
-            if file.endswith('tbn'):
+            if file.endswith('tbn') or (self.PRIORITY == '2' and 
self.LocalImagesFound):
                 self.CachedImagesFound = True
 
         if self.CachedImagesFound:
@@ -316,11 +333,26 @@ class Main:
         else:
             last_time = 0
             if self.ARTISTNUM == 1:
-                if len ( self.PROGRESSPATH ) > 0:
-                    self.WINDOW.setProperty("ArtistSlideshow", 
self.PROGRESSPATH)
+                for cache_file in ['artistimageshtbackdrops.nfo', 
'artistimageslastfm.nfo']:
+                    filename = os.path.join( self.CacheDir, cache_file )
+                    if xbmcvfs.exists( os.path.join( self.CacheDir, filename ) 
):
+                        if time.time() - os.path.getmtime(filename) < 1209600:
+                            log('cached %s found' % filename)
+                            show_progress = False
+                        else:
+                           log('outdated %s found' % filename)
+                           show_progress = True
+                if show_progress:
+                    if len ( self.PROGRESSPATH ) > 0:
+                        self.WINDOW.setProperty("ArtistSlideshow", 
self.PROGRESSPATH)
+                    else:
+                        self.WINDOW.setProperty("ArtistSlideshow", 
self.InitDir)
+                        display_dialog = True
                 else:
                     self.WINDOW.setProperty("ArtistSlideshow", self.InitDir)
-                    xbmc.executebuiltin('XBMC.Notification("' + 
__language__(30300) + '", "' + __language__(30301) + '", 10000, ' + 
__addonicon__ + ')')
+
+        if display_dialog:
+            xbmc.executebuiltin('XBMC.Notification("' + 
__language__(30300).encode("utf8") + '", "' + 
__language__(30301).encode("utf8") + '", 5000, ' + __addonicon__ + ')')
 
         if self.LASTFM == "true":
             lastfmlist = self._get_images('lastfm')
@@ -343,7 +375,7 @@ class Main:
             path2 = getCacheThumbName(url, self.BlankDir)
             if not xbmcvfs.exists(path):
                 try:
-                    download(url, path, path2)
+                    download(url, path, path2, display_dialog)
                 except:
                     log ('site unreachable')
                 else:
@@ -366,7 +398,7 @@ class Main:
                         self._refresh_image_directory()
                     last_time = time.time()
                 self.FirstImage = False
-                    
+                
         if self.ImageDownloaded:
             log('finished downloading images')
             self.DownloadedAllImages = True
@@ -388,6 +420,8 @@ class Main:
                 if( not self._playback_stopped_or_changed() ):
                     self._refresh_image_directory()
             self._clean_dir( self.BlankDir )
+            if display_dialog:
+                xbmc.executebuiltin('XBMC.Notification("' + 
__language__(30304).encode("utf8") + '", "' + 
__language__(30305).encode("utf8") + '", 5000, ' + __addonicon__ + ')')
 
         if not self.ImageDownloaded:
             log('no images downloaded')
@@ -395,7 +429,9 @@ class Main:
             if not self.CachedImagesFound:
                 if self.ARTISTNUM == 1:
                     log('clearing ArtistSlideshow property')
-                    self.WINDOW.clearProperty("ArtistSlideshow")
+                    self.WINDOW.setProperty("ArtistSlideshow", self.InitDir)
+                    if display_dialog:
+                        xbmc.executebuiltin('XBMC.Notification("' + 
__language__(30302).encode("utf8") + '", "' + 
__language__(30303).encode("utf8") + '", 10000, ' + __addonicon__ + ')')
                     if( self.ARTISTINFO == "true" and not 
self._playback_stopped_or_changed() ):
                         self._get_artistinfo()
             elif self.TOTALARTISTS > 1:
@@ -433,20 +469,20 @@ class Main:
 
 
     def _get_current_artist( self ):
-        check_title = False
+        featured_artist = ''
         if( xbmc.Player().isPlayingAudio() == True ):
             artist = xbmc.Player().getMusicInfoTag().getArtist()
-            featured_artist = 
xbmc.Player().getMusicInfoTag().getTitle().replace('ft.','feat.').split('feat.')
             if( artist == '' ):
                 artist = 
xbmc.Player().getMusicInfoTag().getTitle()[0:(artist.find('-'))-1]
-            else:
-                check_title = True
+            featured_artist = 
xbmc.Player().getMusicInfoTag().getTitle().replace('ft.','feat.').split('feat.')
         elif( not xbmc.getInfoLabel( self.SKINARTIST ) == '' ):
             artist = xbmc.getInfoLabel( self.SKINARTIST )
+            log('current song title from skin is %s' % xbmc.getInfoLabel( 
self.SKINTITLE ))
+            featured_artist = xbmc.getInfoLabel( self.SKINTITLE 
).replace('ft.','feat.').split('feat.')
         else:
             artist = ''
         artists = artist.replace('ft.','/').replace('feat.','/').split('/')
-        if check_title and len( featured_artist ) > 1:
+        if len( featured_artist ) > 1:
             artists.append( featured_artist[-1] )
         return [a.strip(' ()') for a in artists]
 
@@ -540,19 +576,64 @@ class Main:
 
     def _get_artistinfo( self ):
         site = "lastfm"
-        self.url = self.LastfmURL + '&method=artist.getInfo&artist=' + 
self.NAME.replace('&','%26').replace(' ','+') + '&lang=' + self.LANGUAGE
-        bio = self._get_data(site, 'bio')
+        bio = self._get_local_data( 'bio' )
+        if bio == []:
+            self.url = self.LastfmURL + '&method=artist.getInfo&artist=' + 
self.NAME.replace('&','%26').replace(' ','+') + '&lang=' + self.LANGUAGE
+            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.similar = self._get_local_data( 'similar' )
+        if self.similar == []:
+            self.url = self.LastfmURL + '&method=artist.getSimilar&artist=' + 
self.NAME.replace('&','%26').replace(' ','+')
+            self.similar = self._get_data(site, 'similar')
+        self.albums = self._get_local_data( 'albums' )
+        if self.albums == []:
+            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_local_data( self, item ):
+        data = []
+        local_path = os.path.join( self.LOCALARTISTPATH, self.NAME, 'override' 
)
+        if item == "similar":
+            filename = os.path.join( local_path, 'artistsimilar.nfo' )
+        elif item == "albums":
+            filename = os.path.join( local_path, 'artistsalbums.nfo' )
+        elif item == "bio":
+            filename = os.path.join( local_path, 'artistbio.nfo' )
+        try:
+            xmldata = xmltree.parse(filename).getroot()
+        except:
+            log('invalid local xml file for %s' % item)
+            return data
+        if item == "bio":
+            for element in xmldata.getiterator():
+                if element.tag == "content":
+                    bio = element.text
+                    if not bio:
+                        bio = ''
+                    data.append(bio)
+        elif( item == "similar" or item == "albums" ):
+            for element in xmldata.getiterator():
+                if element.tag == "name":
+                    name = element.text
+                    name.encode('ascii', 'ignore')
+                elif element.tag == "image":
+                    image_text = element.text
+                    if not image_text:
+                        image = ''
+                    else:
+                        image = os.path.join( local_path, item, image_text )
+                    data.append( ( name , image ) )
+        if data == '':
+            log('no %s found in local xml file' % item)
+        return data
+
+
+
     def _get_data( self, site, item ):
         data = []
         match = ''
diff --git a/script.artistslideshow/resources/language/English/strings.xml 
b/script.artistslideshow/resources/language/English/strings.xml
index e4499fb..bc8876d 100644
--- a/script.artistslideshow/resources/language/English/strings.xml
+++ b/script.artistslideshow/resources/language/English/strings.xml
@@ -46,8 +46,12 @@
     <string id="30246">Vietnamese</string>
     <string id="30247">Farsi</string>
   <!-- Dialog Text -->
-    <string id="30300">Please be Patient</string>
-    <string id="30301">Downloading first artist image</string>
+    <string id="30300">Downloading</string>
+    <string id="30301">Downloading artist images</string>
+    <string id="30302">Nothing Downloaded</string>
+    <string id="30303">No images found for artist</string>    
+    <string id="30304">Download Complete</string>
+    <string id="30305">All artist images downloaded</string>    
   <!-- Settings  --> 
     <string id="32000">Download</string>
     <string id="32001">Download images from last.fm</string>
diff --git a/script.artistslideshow/resources/language/Portuguese 
(Brazil)/strings.xml b/script.artistslideshow/resources/language/Portuguese 
(Brazil)/strings.xml
index 69a51d9..66d54b4 100644
--- a/script.artistslideshow/resources/language/Portuguese (Brazil)/strings.xml 
+++ b/script.artistslideshow/resources/language/Portuguese (Brazil)/strings.xml 
@@ -46,8 +46,12 @@
     <string id="30246">Vietnamese</string>
     <string id="30247">Farsi</string>
   <!-- Dialog Text -->
-    <string id="30300">Por favor, aguarde</string>
-    <string id="30301">Baixando primeira imagem do artista</string>
+    <string id="30300">Downloading</string>
+    <string id="30301">Downloading imagens do artista</string>
+    <string id="30302">Nenhum Download efetuado</string>
+    <string id="30303">Não localizei imagens para este artista</string>    
+    <string id="30304">Download finalizado</string>
+    <string id="30305">Foram efetuados downloads de todas as imagens</string>  
  
   <!-- Settings  --> 
     <string id="32000">Download</string>
     <string id="32001">Download imagens do last.fm</string>
@@ -70,4 +74,5 @@
     <string id="32202">  Tamanho do cache máximo (em megabytes)</string>
     <string id="32203">Exibir imagens de progresso durante a primeira 
transferência</string>
     <string id="32204">  Pasta de imagens Progresso</string>
+       <string id="32205">Nome alternativo para a pasta fanart locais</string>
 </strings>

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

Summary of changes:
 script.artistslideshow/addon.xml                   |    4 +-
 script.artistslideshow/changelog.txt               |   12 ++
 script.artistslideshow/default.py                  |  121 ++++++++++++++++----
 .../resources/language/English/strings.xml         |    8 +-
 .../resources/language/French/strings.xml          |   78 +++++++++++++
 .../language/Portuguese (Brazil)/strings.xml       |    9 +-
 6 files changed, 207 insertions(+), 25 deletions(-)
 create mode 100644 script.artistslideshow/resources/language/French/strings.xml


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to