Comment 2 for bug 996663

Revision history for this message
Iván Campaña (ivan-campana) wrote :

Seems like it is having trouble handling some of the fields from each track, probably because of accents or special characters, I had the same error because I use spanish as my main language and some tracks of my collection have accents, I narrowed the problem to line # 209 in the file /usr/lib/unity-lens-music/clementine-scope

This is where it reads all the tracks info and prepares it for the lens to work with, what I saw is that it doesn't have an exception handler (and a fallback in case of problems), so I added one temporarily to avoid having that nasty error report, currently it won't solve the real problem as is (I will work on it to fix it), but at least now it won't crash and won't report errors when reading the library allowing us to use it, the only downside is that probably some songs won't appear (the ones with special characters and accents not being propperly handled).

Here is what I changed:

  for track in self.tracks:
   try:
    title = u"" if track[0] is None else unicode(track[0])
    uri = u"" if track[1] is None else unicode(track[1])
    artist = u"" if track[2] is None else unicode(track[2])
    album = u"" if track[3] is None else unicode(track[3])
    mimetype = u"" if track[4] is None else unicode(track[4])
    albumartist = u"" if track[5] is None else unicode(track[5])
    itemtype = "http://www.semanticdesktop.org/ontologies/2007/03/22/nfo#Audio"
    trackname = title + " - " + album + " - " + artist
   except Exception as e:
    print "Unicode Error({0}): {1}".format(e.errno, e.strerror)
   except:
    print "Unexpected error:", sys.exc_info()[0]

I include the modified file just in case someone wants to copy it.