@protocol.commands.add('count')
def count(context, *args):
    """
    *musicpd.org, music database section:*

        ``count {TAG} {NEEDLE}``

        Counts the number of songs and their total playtime in the db
        matching ``TAG`` exactly.

    *GMPC:*

    - use multiple tag-needle pairs to make more specific searches.
    """
    try:
        query = _query_from_mpd_search_parameters(args, _SEARCH_MAPPING)
    except __HOLE__:
        raise exceptions.MpdArgError('incorrect arguments')
    results = context.core.library.search(query=query, exact=True).get()
    result_tracks = _get_tracks(results)
    return [
        ('songs', len(result_tracks)),
        ('playtime', sum(t.length for t in result_tracks if t.length) / 1000),
    ]
dataset/ETHPy150Open mopidy/mopidy/mopidy/mpd/protocol/music_db.py/count