use codecs module to decode to hex in _sc_decode

'hex' doesn't exist as a decoder for bytes in py3
This commit is contained in:
Johnny Robeson 2016-06-03 16:18:58 -04:00
parent 7ab0964826
commit 42d642f1f6

View file

@ -45,6 +45,7 @@ import mutagen.flac
import mutagen.monkeysaudio
import mutagen.asf
import mutagen.aiff
import codecs
import datetime
import re
import base64
@ -222,7 +223,7 @@ def _sc_decode(soundcheck):
# SoundCheck tags consist of 10 numbers, each represented by 8
# characters of ASCII hex preceded by a space.
try:
soundcheck = soundcheck.replace(b' ', b'').decode('hex')
soundcheck = codecs.decode(soundcheck.replace(b' ', b''), 'hex')
soundcheck = struct.unpack('!iiiiiiiiii', soundcheck)
except (struct.error, TypeError):
# SoundCheck isn't in the format we expect, so return default