The branch, dharma has been updated
       via  9c6a01c9cbafceb715eeed38f547ff522413e468 (commit)
      from  4e8cacac4ea25c84459d00b8947d108994651880 (commit)

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

commit 9c6a01c9cbafceb715eeed38f547ff522413e468
Author: Arne Morten Kvarving <[email protected]>
Date:   Mon Oct 3 09:18:59 2011 +0200

    [script.cdartmanager] -v 1.5.3

diff --git a/script.cdartmanager/addon.xml b/script.cdartmanager/addon.xml
index cb1cc86..b2d2f2f 100644
--- a/script.cdartmanager/addon.xml
+++ b/script.cdartmanager/addon.xml
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
 <addon id="script.cdartmanager"
        name="cdART Manager"
-       version="1.5.2"
+       version="1.5.3"
        provider-name="Giftie">
   <requires>
     <import addon="xbmc.python" version="1.0"/>
diff --git a/script.cdartmanager/changelog.txt 
b/script.cdartmanager/changelog.txt
index 0a735d1..150de11 100644
--- a/script.cdartmanager/changelog.txt
+++ b/script.cdartmanager/changelog.txt
@@ -1,3 +1,7 @@
+1.5.3 
+- fixed HTTP-API database access
+- fixed error when artist name or album title contains a double quote
+
 1.5.2
 - fixed - copy and paste can be a real monster...
 
diff --git a/script.cdartmanager/default.py b/script.cdartmanager/default.py
index a4065c9..582dbe0 100644
--- a/script.cdartmanager/default.py
+++ b/script.cdartmanager/default.py
@@ -20,7 +20,7 @@ __author__        = __addon__.getAddonInfo('author')
 __version__       = __addon__.getAddonInfo('version')
 __credits__       = "Ppic, Reaven, Imaginos, redje, Jair, "
 __credits2__      = "Chaos_666, Magnatism, Kode"
-__date__          = "9-1-11"
+__date__          = "9-29-11"
 __dbversion__     = "1.3.2"
 __dbversionold__  = "1.1.8"
 __addon_path__    = __addon__.getAddonInfo('path')
diff --git a/script.cdartmanager/resources/lib/dharma_code.py 
b/script.cdartmanager/resources/lib/dharma_code.py
index 470b911..e1d11cf 100644
--- a/script.cdartmanager/resources/lib/dharma_code.py
+++ b/script.cdartmanager/resources/lib/dharma_code.py
@@ -24,7 +24,7 @@ def retrieve_album_details( album_id ):
     album = {}
     try:
         xbmc.executehttpapi( "SetResponseFormat()" )
-        xbmc.executehttpapi( "SetResponseFormat(OpenField,)" )
+        xbmc.executehttpapi( "SetResponseFormat(OpenField;)" )
         httpapi_album_detail_query="""SELECT DISTINCT strAlbum, strArtist, 
idAlbum  FROM albumview WHERE idAlbum="%s" AND strAlbum !=''""" % album_id 
         album_title, artist_name, album_localid, dummy = 
xbmc.executehttpapi("QueryMusicDatabase(%s)" % urllib.quote_plus( 
httpapi_album_detail_query ), ).split( "</field>" )
         album['title'] = album_title
diff --git a/script.cdartmanager/resources/lib/gui.py 
b/script.cdartmanager/resources/lib/gui.py
index 3b1f2c8..73247b1 100644
--- a/script.cdartmanager/resources/lib/gui.py
+++ b/script.cdartmanager/resources/lib/gui.py
@@ -860,7 +860,7 @@ class GUI( xbmcgui.WindowXMLDialog ):
                         fn = os.path.join( destination, (  ( 
album["artist"].replace("/", "").replace("'","") ) + " - " + ( 
album["title"].replace("/","").replace("'","") ) + ".png").lower())
                     xbmc.log( "[script.cdartmanager] - Destination Path: %s" % 
destination, xbmc.LOGNOTICE )
                     if not exists(destination):
-                        os.makedirs(destination)
+                        os.makedirs( destination )
                     xbmc.log( "[script.cdartmanager] - Filename: %s" % fn, 
xbmc.LOGNOTICE )
                     if exists(fn):
                         xbmc.log( "[script.cdartmanager] - ################## 
cdART Not being copied, File exists: %s" % fn, xbmc.LOGNOTICE )
diff --git a/script.cdartmanager/resources/lib/musicbrainz_utils.py 
b/script.cdartmanager/resources/lib/musicbrainz_utils.py
index 15c335b..d58b7d0 100644
--- a/script.cdartmanager/resources/lib/musicbrainz_utils.py
+++ b/script.cdartmanager/resources/lib/musicbrainz_utils.py
@@ -27,8 +27,8 @@ def get_musicbrainz_with_singles( album_title, artist, 
e_count ):
     xbmc.log( "[script.cdartmanager] - Retieving MusicBrainz Info - Including 
Singles", xbmc.LOGDEBUG )
     xbmc.log( "[script.cdartmanager] - Artist: %s" % repr(artist), 
xbmc.LOGDEBUG )
     xbmc.log( "[script.cdartmanager] - Album: %s" % repr(album_title), 
xbmc.LOGDEBUG )
-    #artist = artist.replace(" & "," ")
-    #album_title = album_title.replace(" & "," ")
+    artist = artist.replace('"','?')
+    album_title = album_title.replace('"','?')
     try:
         q = """'"%s" AND artist:"%s"'""" % (album_title, artist)
         filter = ReleaseGroupFilter( query=q, limit=1)
@@ -52,14 +52,20 @@ def get_musicbrainz_with_singles( album_title, artist, 
e_count ):
     except WebServiceError, e:
         xbmc.log( "[script.cdartmanager] - Error: %s" % e, xbmc.LOGERROR )
         web_error = "%s" % e
-        if int( web_error.replace( "HTTP Error ", "").replace( ":", "") ) == 
503 and count < 5:
-            xbmc.sleep( 2000 ) # give the musicbrainz server a 2 second break 
hopefully it will recover
-            count += 1
-            album = album = get_musicbrainz_with_singles( album_title, artist, 
count ) # try again
-        elif int( web_error.replace( "HTTP Error ", "").replace( ":", "") ) == 
503 and count > 5:
-            xbmc.log( "[script.cdartmanager] - Script being blocked, attempted 
5 tries with 2 second pauses", xbmc.LOGDEBUG )
-            count = 0
-        else:
+        try:
+            if int( web_error.replace( "HTTP Error ", "").replace( ":", "") ) 
== 503 and count < 5:
+                xbmc.sleep( 2000 ) # give the musicbrainz server a 2 second 
break hopefully it will recover
+                count += 1
+                album = album = get_musicbrainz_with_singles( album_title, 
artist, count ) # try again
+            elif int( web_error.replace( "HTTP Error ", "").replace( ":", "") 
) == 503 and count > 5:
+                xbmc.log( "[script.cdartmanager] - Script being blocked, 
attempted 5 tries with 2 second pauses", xbmc.LOGDEBUG )
+                count = 0
+            else:
+                album["artist"] = ""
+                album["artist_id"] = ""
+                album["id"] = ""
+                album["title"] = ""
+        except:
             album["artist"] = ""
             album["artist_id"] = ""
             album["id"] = ""
@@ -74,8 +80,8 @@ def get_musicbrainz_album( album_title, artist, e_count ):
     xbmc.log( "[script.cdartmanager] - Retieving MusicBrainz Info - Not 
including Singles", xbmc.LOGDEBUG )
     xbmc.log( "[script.cdartmanager] - Artist: %s" % repr(artist), 
xbmc.LOGDEBUG )
     xbmc.log( "[script.cdartmanager] - Album: %s" % repr(album_title), 
xbmc.LOGDEBUG )
-    #artist = artist.replace(" & "," ")
-    #album_title = album_title.replace(" & "," ")
+    artist = artist.replace('"','?')
+    album_title = album_title.replace('"','?')
     try:
         q = """'"%s" AND artist:"%s" NOT type:"Single"'""" % (album_title, 
artist)
         filter = ReleaseGroupFilter( query=q, limit=1)
@@ -97,16 +103,22 @@ def get_musicbrainz_album( album_title, artist, e_count ):
     except WebServiceError, e:
         xbmc.log( "[script.cdartmanager] - Error: %s" % e, xbmc.LOGERROR )
         web_error = "%s" % e
-        if int( web_error.replace( "HTTP Error ", "").replace( ":", "") ) == 
503 and count < 5:
-            xbmc.sleep( 2000 ) # give the musicbrainz server a 2 second break 
hopefully it will recover
-            count += 1
-            album = get_musicbrainz_album( album_title, artist, count ) # try 
again
-        elif int( web_error.replace( "HTTP Error ", "").replace( ":", "") ) == 
503 and count > 5:
-            xbmc.log( "[script.cdartmanager] - Script being blocked, attempted 
5 tries with 2 second pauses", xbmc.LOGDEBUG )
-            count = 0
-        else:
-            xbmc.sleep( 1000 ) # sleep for allowing proper use of webserver
-            album = get_musicbrainz_with_singles( album_title, artist, 0 )
+        try:
+            if int( web_error.replace( "HTTP Error ", "").replace( ":", "") ) 
== 503 and count < 5:
+                xbmc.sleep( 2000 ) # give the musicbrainz server a 2 second 
break hopefully it will recover
+                count += 1
+                album = get_musicbrainz_album( album_title, artist, count ) # 
try again
+            elif int( web_error.replace( "HTTP Error ", "").replace( ":", "") 
) == 503 and count > 5:
+                xbmc.log( "[script.cdartmanager] - Script being blocked, 
attempted 5 tries with 2 second pauses", xbmc.LOGDEBUG )
+                count = 0
+            else:
+                xbmc.sleep( 1000 ) # sleep for allowing proper use of webserver
+                album = get_musicbrainz_with_singles( album_title, artist, 0 )
+        except:
+            album["artist"] = ""
+            album["artist_id"] = ""
+            album["id"] = ""
+            album["title"] = ""
     count = 0
     xbmc.sleep( 1000 ) # sleep for allowing proper use of webserver
     return album

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

Summary of changes:
 script.cdartmanager/addon.xml                      |    2 +-
 script.cdartmanager/changelog.txt                  |    4 ++
 script.cdartmanager/default.py                     |    2 +-
 script.cdartmanager/resources/lib/dharma_code.py   |    2 +-
 script.cdartmanager/resources/lib/gui.py           |    2 +-
 .../resources/lib/musicbrainz_utils.py             |   56 ++++++++++++--------
 6 files changed, 42 insertions(+), 26 deletions(-)


hooks/post-receive
-- 
Scripts

------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure contains a
definitive record of customers, application performance, security
threats, fraudulent activity and more. Splunk takes this data and makes
sense of it. Business sense. IT sense. Common sense.
http://p.sf.net/sfu/splunk-d2dcopy1
_______________________________________________
Xbmc-addons mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/xbmc-addons

Reply via email to