audio, local: Fix decoding of exception messages depending on locale

This commit is contained in:
Stein Magnus Jodal 2014-05-20 19:55:12 +02:00
parent 05803591c5
commit dcba410d91
3 changed files with 14 additions and 4 deletions

View File

@ -39,6 +39,10 @@ Feature release.
:meth:`~mopidy.ext.Extension.register_gstreamer_elements`. Use
:meth:`mopidy.ext.Extension.setup` instead, as most extensions already do.
**Audio**
- Fix proper decoding of exception messages that depends on the user's locale.
**HTTP frontend**
- CherryPy and ws4py have been replaced with Tornado. This will hopefully
@ -98,6 +102,8 @@ Feature release.
a ``local scan`` before running the server the first time resulted in a
crash. (Fixes: :issue:`703`)
- Fix proper decoding of exception messages that depends on the user's locale.
v0.18.3 (2014-02-16)
====================

View File

@ -10,7 +10,7 @@ import gst # noqa
from mopidy import exceptions
from mopidy.models import Album, Artist, Track
from mopidy.utils import path
from mopidy.utils import encoding, path
class Scanner(object):
@ -90,7 +90,8 @@ class Scanner(object):
message = self._bus.pop()
if message.type == gst.MESSAGE_ERROR:
raise exceptions.ScannerError(message.parse_error()[0])
raise exceptions.ScannerError(
encoding.locale_decode(message.parse_error()[0]))
elif message.type == gst.MESSAGE_EOS:
return tags
elif message.type == gst.MESSAGE_ASYNC_DONE:

View File

@ -13,6 +13,7 @@ import time
import mopidy
from mopidy import local, models
from mopidy.local import search, storage, translator
from mopidy.utils import encoding
logger = logging.getLogger(__name__)
@ -22,8 +23,10 @@ def load_library(json_file):
try:
with gzip.open(json_file, 'rb') as fp:
return json.load(fp, object_hook=models.model_json_decoder)
except (IOError, ValueError) as e:
logger.warning('Loading JSON local library failed: %s', e)
except (IOError, ValueError) as error:
logger.warning(
'Loading JSON local library failed: %s',
encoding.locale_decode(error))
return {}