From 928d5d83040fe4058060db4df59cc4b601a89750 Mon Sep 17 00:00:00 2001 From: Guilherme Rugai Freire <41879254+GRFreire@users.noreply.github.com> Date: Fri, 20 Aug 2021 10:48:36 -0300 Subject: [PATCH] vid2mov: add optional dependency notify-send --- vid2mov/README.md | 1 + vid2mov/vid2mov.sh | 10 ++++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/vid2mov/README.md b/vid2mov/README.md index b514d89..d17e1fb 100644 --- a/vid2mov/README.md +++ b/vid2mov/README.md @@ -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) diff --git a/vid2mov/vid2mov.sh b/vid2mov/vid2mov.sh index d433d15..5f7ccc0 100755 --- a/vid2mov/vid2mov.sh +++ b/vid2mov/vid2mov.sh @@ -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