34 lines
531 B
Bash
Executable file
34 lines
531 B
Bash
Executable file
#!/bin/sh
|
|
|
|
usage() {
|
|
cat <<EOF
|
|
youtube-mp3
|
|
adds options to youtube-dl to download as MP3
|
|
|
|
Usage: youtube-mp3 URL
|
|
|
|
Additional flags for youtube-dl may be specified.
|
|
EOF
|
|
}
|
|
|
|
# Check for youtube-dl in path
|
|
if ! (command -v youtube-dl) ; then
|
|
echo "No youtube-dl found in path"
|
|
exit 1
|
|
fi
|
|
|
|
# Check for ffmpeg in path
|
|
if ! (command -v ffmpeg) ; then
|
|
echo "No ffmpeg found in path"
|
|
exit 1
|
|
fi
|
|
|
|
case "$@" in
|
|
--help)
|
|
usage
|
|
exit 1
|
|
;;
|
|
*)
|
|
youtube-dl --format bestaudio -x --audio-format mp3 --audio-quality 192K -k "$@"
|
|
;;
|
|
esac
|