29 lines
393 B
Bash
Executable file
29 lines
393 B
Bash
Executable file
#!/bin/bash
|
|
# wrapper around youtube-dl
|
|
|
|
DOWNLOAD_DIR="/mnt/incoming/pytubedl/"
|
|
|
|
usage(){
|
|
echo "$0 <url>"
|
|
exit 1
|
|
}
|
|
|
|
# check args
|
|
if [ -z "$1" ]; then
|
|
usage
|
|
fi
|
|
url="$1"
|
|
|
|
# check process
|
|
pgrep youtube-dl
|
|
ret=$?
|
|
|
|
if [ ${ret} -eq 0 ]; then
|
|
echo "Another youtube-dl process is already running."
|
|
exit 2
|
|
fi
|
|
|
|
pushd ${PWD}
|
|
cd "${DOWNLOAD_DIR}"
|
|
youtube-dl -o "%(title)s-%(id)s.%(ext)s" "$url"
|
|
popd
|