metaflac-field2field: reindent with 4 spaces

This commit is contained in:
Matteo Cypriani 2018-04-11 21:48:55 +02:00
parent d06558144b
commit 22783997cc
1 changed files with 32 additions and 32 deletions

View File

@ -20,27 +20,27 @@
print_usage() print_usage()
{ {
echo "Usage:" echo "Usage:"
echo " $0 <ACTION> <SRC_FIELD> <DST_FIELD> <FILE.flac> [ <FILE2.flac> [...] ]" echo " $0 <ACTION> <SRC_FIELD> <DST_FIELD> <FILE.flac> [ <FILE2.flac> [...] ]"
echo "<ACTION> : copy | move | rmcopy | mvcopy" echo "<ACTION> : copy | move | rmcopy | mvcopy"
echo " copy: each occurrence of SRC_FIELD is duplicated to create an occurrence of" echo " copy: each occurrence of SRC_FIELD is duplicated to create an occurrence of"
echo " DST_FIELD; all the existing occurrences of SRC_FIELD and DST_FIELD are" echo " DST_FIELD; all the existing occurrences of SRC_FIELD and DST_FIELD are"
echo " kept." echo " kept."
echo " move: each occurrence of SRC_FIELD is renamed to create an occurrence of" echo " move: each occurrence of SRC_FIELD is renamed to create an occurrence of"
echo " DST_FIELD; the existing occurrences of DST_FIELD are kept." echo " DST_FIELD; the existing occurrences of DST_FIELD are kept."
echo " rmcopy: the existing occurrences of DST_FIELD are deleted, then each" echo " rmcopy: the existing occurrences of DST_FIELD are deleted, then each"
echo " occurrence of SRC_FIELD is duplicated to create an occurrence" echo " occurrence of SRC_FIELD is duplicated to create an occurrence"
echo " of DST_FIELD; the occurrences of SRC_FIELD are kept." echo " of DST_FIELD; the occurrences of SRC_FIELD are kept."
echo " rmmove: the existing occurrences of DST_FIELD are deleted, then each" echo " rmmove: the existing occurrences of DST_FIELD are deleted, then each"
echo " occurrence of SRC_FIELD is renamed to create an occurrence of" echo " occurrence of SRC_FIELD is renamed to create an occurrence of"
echo " DST_FIELD." echo " DST_FIELD."
exit 1 exit 1
} }
# Right number of arguments? # Right number of arguments?
if [ $# -lt 4 ] ; then if [ $# -lt 4 ] ; then
echo "Wrong number of arguments!" echo "Wrong number of arguments!"
print_usage print_usage
fi fi
ACTION=$1 ACTION=$1
@ -48,11 +48,11 @@ shift
# Known action type? # Known action type?
case $ACTION in case $ACTION in
copy) ;; copy) ;;
move) ;; move) ;;
rmcopy) ;; rmcopy) ;;
rmmove) ;; rmmove) ;;
*) echo "Action unknown \"$ACTION\"!" ; print_usage ;; *) echo "Action unknown \"$ACTION\"!" ; print_usage ;;
esac esac
SRC_FIELD=$1 SRC_FIELD=$1
@ -67,21 +67,21 @@ echo "Action: $ACTION"
echo "Processing files..." echo "Processing files..."
if echo $ACTION | egrep '^rm' >/dev/null ; then if echo $ACTION | egrep '^rm' >/dev/null ; then
echo "Deleting field $DST_FIELD on each file..." echo "Deleting field $DST_FIELD on each file..."
metaflac --remove-tag=$DST_FIELD "$@" metaflac --remove-tag=$DST_FIELD "$@"
fi fi
for file in "$@" ; do for file in "$@" ; do
echo "Setting field \"$DST_FIELD\" on file: $file" echo "Setting field \"$DST_FIELD\" on file: $file"
metaflac --show-tag=$SRC_FIELD "$file" | sed 's/^[A-Z]\+=//' | while read c1 ; do metaflac --show-tag=$SRC_FIELD "$file" | sed 's/^[A-Z]\+=//' | while read c1 ; do
echo "Adding $DST_FIELD=$c1..." echo "Adding $DST_FIELD=$c1..."
metaflac --set-tag=$DST_FIELD="$c1" "$file" metaflac --set-tag=$DST_FIELD="$c1" "$file"
done done
done done
if echo $ACTION | egrep 'move$' >/dev/null ; then if echo $ACTION | egrep 'move$' >/dev/null ; then
echo "Deleting $SRC_FIELD on each file..." echo "Deleting $SRC_FIELD on each file..."
metaflac --remove-tag=$SRC_FIELD "$@" metaflac --remove-tag=$SRC_FIELD "$@"
fi fi
# vim: expandtab!:ts=2 # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4