#!/bin/bash # doc cmd_exclude { # # DESCRIPTION # cmd_exclude - Excludes track that matches CONDITION in DB_FILE # # USAGE # cmd_exclude <...> # # CONDITIONS # CONDITIONS are defined using the following format: # = # The metadata field can be anything that can be injected as metadata in a Vorbis or id3tag. # # } cmd_exclude() { local GIT_DIR="${1}" local TARGET="${2}" local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2 local conditionList=("${@}") [[ ! -f "${DB_FILE}" ]] && return 1 [[ ! -f "${GIT_DIR}/.git" ]] && return 2 for condition in ${conditionList[@]}; do _msg EXEC "Excluding all tracks that match the following condition: ${condition}" db_set ${GIT_DIR} ${DB_FILE} false "${condition}" [[ $? -ne 0 ]] && { _msg WARN; } || { _msg OK; } done local imageidList=($(awk 'BEGIN{FS="\t"}{if($1=="true"){print $2}}' ${DB_FILE} | awk '!seen[$0]++')) local DU="$(print_imageid_du ${GIT_DIR} ${imageidList[@]})" _msg ECHO "Current estimated disk usage: ${DU} bytes" }