Import volumes

    SOURCE must be a json file and must follow the same structure used in `libreant-db export`.
    Pass - to read from standard input.

def import_volumes(source, ignore_conflicts, yes):
    '''Import volumes

    SOURCE must be a json file and must follow the same structure used in `libreant-db export`.
    Pass - to read from standard input.
    '''
    volumes = json.load(source)
    tot = len(volumes)
    if not yes:
        click.confirm("Are you sure you want to import {} volumes into index '{}'".format(tot, arc._config['ES_INDEXNAME']))
    conflicts=0
    with click.progressbar(volumes, label='adding volumes') as bar:
        for v in bar:
            try:
                arc.import_volume(v)
            except ConflictException as ce:
                if not ignore_conflicts:
                    die(str(ce))
                conflicts += 1
            except Exception as e:
                if conf.get('DEBUG', False):
                    raise
                else:
                    die(str(e))

    if conflicts > 0:
        click.echo("{} volumes has been skipped beacause of a conflict".format(conflicts))