'Instanciate queries for the playlists.
Each playlist has 2 queries: one or items one for albums, each with a
sort. We must also remember its name. _unmatched_playlists is a set of
tuples (name, (q, q_sort), (album_q, album_q_sort)).
sort may be any sort, or NullSort, or None. None and NullSort are
equivalent and both eval to False.
More precisely
- it will be NullSort when a playlist query (\'query\' or \'album_query\')
is a single item or a list with 1 element
- it will be None when there are multiple items i a query'

def build_queries(self):

    self._unmatched_playlists = set()
    self._matched_playlists = set()
    for playlist in self.config['playlists'].get(list):
        if ('name' not in playlist):
            self._log.warning(u'playlist    configuration    is    missing    name')
            continue
        playlist_data = (playlist['name'],)
        try:
            for (key, Model) in (('query', Item), ('album_query', Album)):
                qs = playlist.get(key)
                if (qs is None):
                    query_and_sort = (None, None)
                elif isinstance(qs, six.string_types):
                    query_and_sort = parse_query_string(qs, Model)
                elif (len(qs) == 1):
                    query_and_sort = parse_query_string(qs[0], Model)
                else:
                    (queries, sorts) = zip(*(parse_query_string(q, Model) for q in qs))
                    query = OrQuery(queries)
                    final_sorts = []
                    for s in sorts:
                        if s:
                            if isinstance(s, MultipleSort):
                                final_sorts += s.sorts
                            else:
                                final_sorts.append(s)
                    if (not final_sorts):
                        sort = None
                    elif (len(final_sorts) == 1):
                        (sort,) = final_sorts
                    else:
                        sort = MultipleSort(final_sorts)
                    query_and_sort = (query, sort)
                playlist_data += (query_and_sort,)
        except ParsingError as exc:
            self._log.warning(u'invalid    query    in    playlist    {}:    {}', playlist['name'], exc)
            continue
        self._unmatched_playlists.add(playlist_data)
