30 lines
872 B
Text
30 lines
872 B
Text
![]() |
#!/bin/bash
|
||
|
|
||
|
# doc cmd_include {
|
||
|
#
|
||
|
# DESCRIPTION
|
||
|
# cmd_include - Include track that matches CONDITION in DB_FILE
|
||
|
#
|
||
|
# USAGE
|
||
|
# cmd_include </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.
|
||
|
#
|
||
|
# }
|
||
|
|
||
|
cmd_include() {
|
||
|
local GIT_DIR="${1}"
|
||
|
local TARGET="${2}"
|
||
|
local DB_FILE="${TARGET}/${_OPT_DB_FILE}"; shift 2
|
||
|
local conditionList==("${@}")
|
||
|
|
||
|
for condition in ${conditionList[@]}; do
|
||
|
_msg EXEC "Including all tracks that match the following condition: ${condition}"
|
||
|
db_set ${GIT_DIR} ${DB_FILE} true "${condition}"
|
||
|
[[ $? -ne 0 ]] && { _msg WARN; return 1; } || { _msg OK; return 0; }
|
||
|
done
|
||
|
}
|