From 81d1878ff325f0a41fc34fdaa4005e5b3ab48407 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sun, 2 Oct 2016 23:20:23 +0200 Subject: extract title for notification --- hel/recv-media.nix | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/hel/recv-media.nix b/hel/recv-media.nix index 9cc7b014..06483cdf 100644 --- a/hel/recv-media.nix +++ b/hel/recv-media.nix @@ -1,4 +1,4 @@ -{ stdenv, coreutils, writeScriptBin, eject }: +{ stdenv, coreutils, writeScriptBin, eject, ffmpeg }: writeScriptBin "recv-media" '' #!${stdenv.shell} @@ -23,5 +23,9 @@ writeScriptBin "recv-media" '' touch -c -m -t "$2" "''${target}" fi - printf "%s\n%s\n" $(basename "$1") "" | /var/setuid-wrappers/notify-gkleen -a recv-media || true + ( + title=$(${ffmpeg}/bin/ffmpeg -i "''${target}" -f ffmetadata 2>/dev/null | sed -r '/^title=/!d; s/^title=//') + [[ -z "''${title}" ]] && title=$(basename "$1") + printf "%s\n%s\n" "''${title}" "" | /var/setuid-wrappers/notify-gkleen -a recv-media || true + ) || true '' -- cgit v1.2.3