From 565b3aeb985897773ead5ba397c9956dc05faa24 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sat, 28 Dec 2013 00:06:16 +0100 Subject: [PATCH] audio: Workaround fact that genre can sometimes be a list --- mopidy/audio/scan.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/mopidy/audio/scan.py b/mopidy/audio/scan.py index f797a84d..0c8e3478 100644 --- a/mopidy/audio/scan.py +++ b/mopidy/audio/scan.py @@ -181,6 +181,12 @@ def audio_data_to_track(data): track_kwargs['uri'] = data['uri'] track_kwargs['album'] = Album(**album_kwargs) + # TODO: this feels like a half assed workaround. we need to be sure that we + # don't suddenly have lists in our models where we expect strings etc + if ('genre' in track_kwargs and + not isinstance(track_kwargs['genre'], basestring)): + track_kwargs['genre'] = ', '.join(track_kwargs['genre']) + if ('name' in artist_kwargs and not isinstance(artist_kwargs['name'], basestring)): track_kwargs['artists'] = [Artist(name=artist)