2018-03-19 15:09:06 -04:00
|
|
|
#!/bin/bash
|
|
|
|
|
2018-03-28 19:26:38 -04:00
|
|
|
# doc cmd_exclude {
|
|
|
|
#
|
|
|
|
# DESCRIPTION
|
|
|
|
# cmd_exclude - Excludes track that matches CONDITION in DB_FILE
|
|
|
|
#
|
|
|
|
# USAGE
|
|
|
|
# cmd_exclude </path/to/dir/dir> </path/to/target> </path/to/db_file> <condition_1> <condition_2> <...>
|
|
|
|
#
|
|
|
|
# CONDITIONS
|
|
|
|
# CONDITIONS are defined using the following format:
|
|
|
|
# <metadata field>=<value>
|
|
|
|
# The metadata field can be anything that can be injected as metadata in a Vorbis or id3tag.
|
|
|
|
#
|
|
|
|
# }
|
2018-03-19 15:09:06 -04:00
|
|
|
|
|
|
|
cmd_exclude() {
|
2018-03-28 19:26:38 -04:00
|
|
|
local GIT_DIR="${1}"
|
|
|
|
local TARGET="${2}"
|
|
|
|
local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2
|
|
|
|
local conditionList==("${@}")
|
2018-03-19 15:09:06 -04:00
|
|
|
|
2018-03-28 19:26:38 -04:00
|
|
|
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; return 1; } || { _msg OK; return 0; }
|
|
|
|
done
|
2018-03-19 15:09:06 -04:00
|
|
|
}
|