Fix #1895: don't assume SC data is bytes

This commit is contained in:
Adrian Sampson 2016-02-26 12:23:32 -08:00
parent 7202b3d413
commit a751d6d442
2 changed files with 7 additions and 1 deletions

View file

@ -211,9 +211,14 @@ def _pack_asf_image(mime, data, type=3, description=""):
# iTunes Sound Check encoding.
def _sc_decode(soundcheck):
"""Convert a Sound Check string value to a (gain, peak) tuple as
"""Convert a Sound Check bytestring value to a (gain, peak) tuple as
used by ReplayGain.
"""
# We decode binary data. If one of the formats gives us a text
# string, guess that it's UTF-8.
if isinstance(soundcheck, unicode):
soundcheck = soundcheck.decode('utf8')
# SoundCheck tags consist of 10 numbers, each represented by 8
# characters of ASCII hex preceded by a space.
try:

View file

@ -8,6 +8,7 @@ Fixes:
* Fix a problem with the :ref:`stats-cmd` in exact mode when filenames on
Windows use non-ASCII characters. :bug:`1891`
* Fix a crash when iTunes Sound Check tags contained invalid data. :bug:`1895`
1.3.17 (February 7, 2016)