diff --git a/mopidy_gmusic/library.py b/mopidy_gmusic/library.py index bb447ac..9bad6f0 100644 --- a/mopidy_gmusic/library.py +++ b/mopidy_gmusic/library.py @@ -482,7 +482,7 @@ def _search_library(self, query=None, uris=None): result_tracks = self.tracks.values() for (field, values) in query.items(): - if not hasattr(values, "__iter__"): + if not isinstance(values, list): values = [values] # FIXME this is bound to be slow for large libraries for value in values: @@ -528,21 +528,25 @@ def any_filter(track): ) if field == "uri": - result_tracks = filter(uri_filter, result_tracks) + result_tracks = list(filter(uri_filter, result_tracks)) elif field == "track_name": - result_tracks = filter(track_name_filter, result_tracks) + result_tracks = list( + filter(track_name_filter, result_tracks) + ) elif field == "album": - result_tracks = filter(album_filter, result_tracks) + result_tracks = list(filter(album_filter, result_tracks)) elif field == "artist": - result_tracks = filter(artist_filter, result_tracks) + result_tracks = list(filter(artist_filter, result_tracks)) elif field == "albumartist": - result_tracks = filter(albumartist_filter, result_tracks) + result_tracks = list( + filter(albumartist_filter, result_tracks) + ) elif field == "track_no": - result_tracks = filter(track_no_filter, result_tracks) + result_tracks = list(filter(track_no_filter, result_tracks)) elif field == "date": - result_tracks = filter(date_filter, result_tracks) + result_tracks = list(filter(date_filter, result_tracks)) elif field == "any": - result_tracks = filter(any_filter, result_tracks) + result_tracks = list(filter(any_filter, result_tracks)) else: raise LookupError("Invalid lookup field: %s" % field)