mirror of
https://github.com/hydroxycarbamide/dotfiles.git
synced 2025-05-07 21:39:07 -04:00
Add nnn
This commit is contained in:
parent
0ef5de12ac
commit
c0889285ff
58 changed files with 5175 additions and 0 deletions
41
dot_config/nnn/plugins/executable_mp3conv
Normal file
41
dot_config/nnn/plugins/executable_mp3conv
Normal file
|
@ -0,0 +1,41 @@
|
|||
#!/usr/bin/env sh
|
||||
|
||||
# Description: Extract audio from multimedia files and convert to mp3
|
||||
#
|
||||
# Dependencies: ffmpeg compiled with libmp3lame audio codec support
|
||||
#
|
||||
# Shell: POSIX compliant
|
||||
# Author: Arun Prakash Jana
|
||||
|
||||
outdir=_mp3files
|
||||
|
||||
handle_multimedia() {
|
||||
mime="${1}"
|
||||
file="${2}"
|
||||
|
||||
case "${mime}" in
|
||||
audio/* | video/*)
|
||||
ffmpeg -i "${file}" -vn -codec:a libmp3lame -q:a 2 "${outdir}/${file%.*}.mp3"
|
||||
;;
|
||||
*)
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
printf "Process 'a'll in directory or 'c'urrent? "
|
||||
read -r resp
|
||||
|
||||
if [ "$resp" = "a" ]; then
|
||||
if ! [ -e "${outdir}" ]; then
|
||||
mkdir "${outdir}"
|
||||
fi
|
||||
|
||||
for f in *; do
|
||||
if [ -f "${f}" ]; then
|
||||
mimestr="$( file --dereference --brief --mime-type -- "${f}" )"
|
||||
handle_multimedia "${mimestr}" "${f}"
|
||||
fi
|
||||
done
|
||||
elif [ "$resp" = "c" ] && [ -f "$1" ]; then
|
||||
ffmpeg -i "${1}" -vn -codec:a libmp3lame -q:a 2 "${1%.*}.mp3"
|
||||
fi
|
Loading…
Add table
Add a link
Reference in a new issue