Author: duncan
Date: Sat Sep 30 13:18:12 2006
New Revision: 8280
Modified:
branches/rel-1-5/freevo/src/audio/plugins/coversearch.py
Log:
[ 1565765 ] Coversearch crashes when artist or album has unicode char
Fixed for latin-1 locales and maybe others.
Modified: branches/rel-1-5/freevo/src/audio/plugins/coversearch.py
==============================================================================
--- branches/rel-1-5/freevo/src/audio/plugins/coversearch.py (original)
+++ branches/rel-1-5/freevo/src/audio/plugins/coversearch.py Sat Sep 30
13:18:12 2006
@@ -181,13 +181,17 @@
album = self.item.getattr('title')
artist = self.item.getattr('artist')
- search_string = '%s %s' % (String(artist), String(album))
+
+ # Maybe the search string need encoding to config.LOCALE
+ search_string = '%s %s' % (artist.encode('latin-1'),
album.encode('latin-1'))
search_string = re.sub('[\(\[].*[\)\]]', '', search_string)
+ if config.DEBUG > 1:
+ print "search_string=%r" % search_string
try:
cover = amazon.searchByKeyword(search_string ,
product_line="music")
except amazon.AmazonError:
box.destroy()
- dict_tmp = { "artist": artist.encode('ascii','replace'), "album":
album.encode('ascii','replace') }
+ dict_tmp = { "artist": artist, "album": album }
box = PopupBox(text=_( 'No matches for %(artist)s - %(album)s' ) %
dict_tmp )
box.show()
time.sleep(2)
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog