* Chris Vanden Berghe <[EMAIL PROTECTED]> [2005-04-23 12:00]: > I've tried it with MP3's and got the following error message. I looked > very quickly in the code, but didn't immediately found the problem. If > v2tag.album = a_title > pyid3lib.ID3Error: 'album' attribute must be string
Yeah, that was pretty much to be expected. Apply that patch on top of the previous one: --- /home/tbm/jack_tag.py 2005-04-23 12:36:54.000000000 +0100 +++ ./jack_tag.py 2005-04-23 13:03:14.000000000 +0100 @@ -97,13 +97,13 @@ if jack_helpers.helpers[cf['_encoder']]['target'] in ("mp3", "flac"): if jack_helpers.helpers[cf['_encoder']]['target'] == "mp3" and cf['_write_id3v2']: v2tag = pyid3lib.tag(mp3name) - v2tag.album = a_title + v2tag.album = a_title.encode("utf-8") v2tag.track = (i[NUM], len(jack_ripstuff.all_tracks_orig)) - v2tag.title = t_name + v2tag.title = t_name.encode("utf-8") if t_artist: - v2tag.artist = t_artist + v2tag.artist = t_artist.encode("utf-8") else: - v2tag.artist = a_artist + v2tag.artist = a_artist.encode("utf-8") if cf['_id3_genre'] == 255: try: del v2tag.contenttype @@ -117,17 +117,17 @@ v2tag.update() if cf['_write_id3v1']: id3 = ID3(mp3name) - id3.album = a_title + id3.album = a_title.encode("latin-1", "replace") id3.track = i[NUM] # this is ignored if we have an ID3v1.0 tag if t_comm: - id3.comment = t_comm - id3.title = t_name2 + id3.comment = t_comm.encode("latin-1", "replace") + id3.title = t_name2.encode("latin-1", "replace") else: - id3.title = t_name + id3.title = t_name.encode("latin-1", "replace") if t_artist: - id3.artist = t_artist + id3.artist = t_artist.encode("latin-1", "replace") else: - id3.artist = a_artist + id3.artist = a_artist.encode("latin-1", "replace") if cf['_id3_genre'] != -1: id3.genre = cf['_id3_genre'] elif not id3.had_tag: @@ -164,7 +164,10 @@ for char_i in range(len(cf['_unusable_chars'])): newname = string.replace(newname, cf['_unusable_chars'][char_i], cf['_replacement_chars'][char_i]) oldname = i[NAME] - i[NAME] = unicode(i[NAME], "utf-8") + try: + i[NAME] = unicode(i[NAME], "utf-8") + except UnicodeDecodeError: + i[NAME] = unicode(i[NAME], "latin-1") if i[NAME] != newname: p_newname = newname.encode(locale.getpreferredencoding(), "replace") newname = newname.encode("utf-8", "replace") -- Martin Michlmayr http://www.cyrius.com/ -- To UNSUBSCRIBE, email to [EMAIL PROTECTED] with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]