vid2mov: add optional dependency notify-send

This commit is contained in:
Guilherme Rugai Freire 2021-08-20 10:48:36 -03:00
parent 2eb9a11263
commit 928d5d8304
No known key found for this signature in database
GPG Key ID: 0F9FE41723A8A297
2 changed files with 9 additions and 2 deletions

View File

@ -7,3 +7,4 @@ I personally use this script when I record something in OBS Studio and then want
## Requirements
- [ffmpeg](https://www.ffmpeg.org/)
- [notify-send](https://gitlab.gnome.org/GNOME/libnotify) (optional)

View File

@ -1,5 +1,11 @@
#!/bin/sh
notify() {
if [ "$(command -v notify-send)" ]; then
notify-send "$@"
fi
}
VIDEO_PATH=$1
[ "$VIDEO_PATH" = "" ] && echo "error: video_path not given" && exit 1
@ -7,11 +13,11 @@ VIDEO_PATH=$1
if ffmpeg -i "$VIDEO_PATH" -vcodec mpeg4 -q:v 2 -acodec pcm_s16le -q:a 0 -f mov "$OUT_PATH"; then
echo "Done"
notify-send "vid2mov" "$OUT_PATH done converting"
notify "vid2mov" "$OUT_PATH done converting"
exit 0
else
echo "Failed"
notify-send -u critical "vid2mov" "$OUT_PATH error while converting"
notify -u critical "vid2mov" "$OUT_PATH error while converting"
exit 1
fi