Commits

fab31 committed c9471b4

Fix unicode in search command

Comments (0)

Files changed (1)

zicbee/core/commands/search.py

         def song_output(song): pass
     else:
         def song_output(song):
-            txt = '%s :\n%s [%s, score: %s, tags: %s]'%(song.filename,
-                    '%s - %s - %s'%(song.artist, song.album, song.title),
+            try:
+                fname = song.filename.decode('utf-8')
+            except UnicodeError:
+                fname = song.filename.decode('latin1')
+            print u'%s :\n%s [%s, score: %s, tags: %s]'%(fname,
+                    u'%s - %s - %s'%(song.artist, song.album, song.title),
                     duration_tidy(song.length), song.score, song.tags,
                     )
-            print txt.decode('utf8').encode('utf8')
 
     pat, kw = string2python(' '.join(zshell.args))
     if edit_mode: