From 09ba625fef9169190eb8c764a8c64ce2ed232101 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Mon, 4 Jun 2018 10:56:02 +0200 Subject: ensure nonempty summary --- custom/recv-media.sh | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'custom') diff --git a/custom/recv-media.sh b/custom/recv-media.sh index 03c37e06..2f291dcc 100644 --- a/custom/recv-media.sh +++ b/custom/recv-media.sh @@ -46,11 +46,16 @@ fi if @donotify@; then ( + summary="" + if @showtitle@; then - summary=$(@ffmpeg@/bin/ffmpeg -i "${target}" -f ffmetadata pipe:1 2>/dev/null | sed -r '/\[CHAPTER\]/q; /^title=/!d; s/^title=//') - else + summary=$(@ffmpeg@/bin/ffmpeg -i "${target}" -f ffmetadata pipe:1 2>/dev/null | sed -r '/\[CHAPTER\]/q; /^title=/!d; s/^title=//; s/(^\s*|\s*$)//g') + fi + + if [[ -z "${summary}" ]]; then summary=${target:t} fi + printf "%s\n%s\n" "${summary}" "" | @notify@ -a recv-media || true ) || true fi -- cgit v1.2.3