forked from ahurac/dotfiles
bin : suppression convertofut
This commit is contained in:
parent
92def7b86b
commit
03e49268f1
1 changed files with 0 additions and 50 deletions
|
@ -1,50 +0,0 @@
|
|||
#!/bin/sh
|
||||
|
||||
error() {
|
||||
printf '\033[1;31m%s\033[0m %s\n' "ERROR:" "$1"
|
||||
shift
|
||||
exit "$1"
|
||||
}
|
||||
|
||||
trap 'error "$error" "$?"' EXIT; set -e
|
||||
|
||||
error="Le premier argument doit être l'extension des fichiers à convertir."
|
||||
[ -n "$1" ]; format_in="$1" ; shift
|
||||
error="Le second argument doit être l'extension des fichiers convertis."
|
||||
[ -n "$1" ]; format_out="$1"; shift
|
||||
|
||||
set +e; trap - EXIT
|
||||
|
||||
while [ -z "$input" ] ; do
|
||||
printf '%s' "Dossier à convertir : "
|
||||
read -r input
|
||||
done
|
||||
|
||||
output=../output
|
||||
|
||||
set -e
|
||||
cd "$input"
|
||||
mkdir -p "$output"
|
||||
set +e
|
||||
|
||||
case "$format_out" in
|
||||
mp3)
|
||||
options="-ab 320k"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
|
||||
for file in **/*".${format_in}"; do
|
||||
while [ "$(jobs -p | wc -l)" -ge 10 ]; do
|
||||
sleep 1
|
||||
done
|
||||
basename "$file"
|
||||
output_file="${output}/$(dirname "$file")/$(basename "${file}" ".${format_in}").${format_out}"
|
||||
mkdir -p "$(dirname "${output_file}")"
|
||||
# shellcheck disable=SC2086
|
||||
ffmpeg -loglevel quiet -i "$file" $options "$output_file" &
|
||||
done
|
||||
|
||||
wait
|
||||
|
Loading…
Reference in a new issue