'The CLI command function for `beet play`. Create a list of paths
from query, determine if tracks or albums are to be played.'

def _play_command(self, lib, opts, args):

    use_folders = config['play']['use_folders'].get(bool)
    relative_to = config['play']['relative_to'].get()
    if relative_to:
        relative_to = util.normpath(relative_to)
    if opts.album:
        selection = lib.albums(ui.decargs(args))
        paths = []
        sort = lib.get_default_album_sort()
        for album in selection:
            if use_folders:
                paths.append(album.item_dir())
            else:
                paths.extend((item.path for item in sort.sort(album.items())))
        item_type = 'album'
    else:
        selection = lib.items(ui.decargs(args))
        paths = [item.path for item in selection]
        if relative_to:
            paths = [relpath(path, relative_to) for path in paths]
        item_type = 'track'
    if (not selection):
        ui.print_(ui.colorize('text_warning', u'No    {0}    to    play.'.format(item_type)))
        return
    open_args = self._playlist_or_paths(paths)
    command_str = self._command_str(opts.args)
    if (opts.yes or (not self._exceeds_threshold(selection, command_str, open_args, item_type))):
        play(command_str, selection, paths, open_args, self._log, item_type)
