Author: duncan
Date: Wed Jun  6 16:51:32 2007
New Revision: 9657

Modified:
   branches/rel-1/freevo/ChangeLog
   branches/rel-1/freevo/src/audio/plugins/coversearch.py

Log:
[ 1731835 ] coversearch crashes on some covers
Fix applied


Modified: branches/rel-1/freevo/ChangeLog
==============================================================================
--- branches/rel-1/freevo/ChangeLog     (original)
+++ branches/rel-1/freevo/ChangeLog     Wed Jun  6 16:51:32 2007
@@ -23,6 +23,7 @@
  * Updated xine video plug-in to allow bookmarks to work (F#1729024)
  * Updated xine video plug-in to process stdout and stderr message (F#1729603)
  * Fixed audio channel selection for AVI files, when no id is present 
(B#1731232)
+ * Fixed CD cover image search because of changes to Amazon developer services 
(B#1731835)
  * Fixed fxd parser's setattr not working correctly in all cases (B#1728421)
  * Fixed Panorama skin thumbnail (B#1731877)
  * Fixed recordings manager not deleting old video when the disk is full 
(B#1728182)

Modified: branches/rel-1/freevo/src/audio/plugins/coversearch.py
==============================================================================
--- branches/rel-1/freevo/src/audio/plugins/coversearch.py      (original)
+++ branches/rel-1/freevo/src/audio/plugins/coversearch.py      Wed Jun  6 
16:51:32 2007
@@ -218,49 +218,49 @@
         # Check if they're valid before presenting the list to the user
         # Grrr I wish Amazon wouldn't return an empty gif (807b)
 
-        MissingFile = False
-        m = None
-        n = None
-
         for i in range(len(cover)):
+            m = None
+            imageFound = False
             try:
-                m = urllib2.urlopen(cover[i].ImageUrlLarge)
+                if cover[i].ImageUrlLarge:
+                    m = urllib2.urlopen(cover[i].ImageUrlLarge)
+                    imageFound = True
             except urllib2.HTTPError:
                 # Amazon returned a 404
-                MissingFile = True
-            if not MissingFile and not (m.info()['Content-Length'] == '807'):
+                pass
+            if imageFound and (m.info()['Content-Length'] != '807'):
                 image = Image.open_from_memory(m.read())
                 items += [ menu.MenuItem('%s' % cover[i].ProductName,
-                                         self.cover_create, 
cover[i].ImageUrlLarge,
-                                         image=image) ]
-                m.close()
+                    self.cover_create, cover[i].ImageUrlLarge, image=image) ]
             else:
-                if m: m.close()
-                MissingFile = False
                 # see if a small one is available
                 try:
-                    n = urllib2.urlopen(cover[i].ImageUrlMedium)
+                    if cover[i].ImageUrlMedium:
+                        if m: m.close()
+                        m = urllib2.urlopen(cover[i].ImageUrlMedium)
+                        imageFound = True
                 except urllib2.HTTPError:
-                    MissingFile = True
-                if not MissingFile and not (n.info()['Content-Length'] == 
'807'):
-                    image = Image.open_from_memory(n.read())
+                    pass
+                if imageFound and (m.info()['Content-Length'] != '807'):
+                    image = Image.open_from_memory(m.read())
                     items += [ menu.MenuItem( ('%s [' + _( 'small' ) + ']') % 
cover[i].ProductName,
-                                    self.cover_create, 
cover[i].ImageUrlMedium) ]
-                    n.close()
+                        self.cover_create, cover[i].ImageUrlMedium) ]
                 else:
-                    if n: n.close()
                     # maybe the url is wrong, try to change '.01.' to '.03.'
                     cover[i].ImageUrlLarge = 
cover[i].ImageUrlLarge.replace('.01.', '.03.')
                     try:
-                        n = urllib2.urlopen(cover[i].ImageUrlLarge)
+                        if cover[i].ImageUrlLarge:
+                            if m: m.close()
+                            m = urllib2.urlopen(cover[i].ImageUrlLarge)
+                            imageFound = True
 
-                        if not (n.info()['Content-Length'] == '807'):
-                            image = Image.open_from_memory(n.read())
+                        if imageFound and (m.info()['Content-Length'] != 
'807'):
+                            image = Image.open_from_memory(m.read())
                             items += [ menu.MenuItem( ('%s [' + _( 'small' ) + 
']' ) % cover[i].ProductName,
-                                                     self.cover_create, 
cover[i].ImageUrlLarge) ]
-                        n.close()
+                                self.cover_create, cover[i].ImageUrlLarge) ]
                     except urllib2.HTTPError:
                         pass
+            if m: m.close()
 
         box.destroy()
         if len(items) == 1:

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog

Reply via email to