Decode all data from tag_cache as utf-8
This commit is contained in:
parent
11bedc46dd
commit
d4437d5adc
@ -84,7 +84,7 @@ def parse_mpd_tag_cache(tag_cache, music_dir=''):
|
||||
_convert_mpd_data(current, tracks, music_dir)
|
||||
current.clear()
|
||||
|
||||
current[key.lower()] = value
|
||||
current[key.lower()] = value.decode('utf-8')
|
||||
|
||||
_convert_mpd_data(current, tracks, music_dir)
|
||||
|
||||
|
||||
@ -116,7 +116,16 @@ class MPDTagCacheToTracksTest(unittest.TestCase):
|
||||
self.assertEqual(set(expected_tracks), tracks)
|
||||
|
||||
def test_unicode_cache(self):
|
||||
raise SkipTest
|
||||
tracks = parse_mpd_tag_cache(data_folder('utf8_tag_cache'),
|
||||
data_folder(''))
|
||||
|
||||
uri = path_to_uri(data_folder('song1.mp3'))
|
||||
artists = [Artist(name=u'æøå')]
|
||||
album = Album(name=u'æøå', artists=artists)
|
||||
track = Track(uri=uri, name=u'æøå', artists=artists,
|
||||
album=album, length=4000)
|
||||
|
||||
self.assertEqual(track, list(tracks)[0])
|
||||
|
||||
def test_misencoded_cache(self):
|
||||
# FIXME not sure if this can happen
|
||||
|
||||
13
tests/data/utf8_tag_cache
Normal file
13
tests/data/utf8_tag_cache
Normal file
@ -0,0 +1,13 @@
|
||||
info_begin
|
||||
mpd_version: 0.14.2
|
||||
fs_charset: UTF-8
|
||||
info_end
|
||||
songList begin
|
||||
key: song1.mp3
|
||||
file: /song1.mp3
|
||||
Time: 4
|
||||
Artist: æøå
|
||||
Title: æøå
|
||||
Album: æøå
|
||||
mtime: 1272319626
|
||||
songList end
|
||||
Loading…
Reference in New Issue
Block a user