From bde0545ce84224d5c24ce5062940ab8754ae49d9 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Sat, 2 Jun 2018 18:09:36 +0200 Subject: ... --- custom/recv-media.sh | 10 +++++----- custom/uucp-mediaclient.nix | 9 +++++---- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/custom/recv-media.sh b/custom/recv-media.sh index 29e3d158..f99aaaf0 100644 --- a/custom/recv-media.sh +++ b/custom/recv-media.sh @@ -7,7 +7,7 @@ exec 2> >(@utillinux@/bin/logger --id=$pid -t recv-media -p user.error) [[ -z "$1" || -z "$2" ]] && exit 2 -dir=@mediaDir@ +dir=@mediadir@ group=$(@coreutils@/bin/stat -c '%G' $dir) tmpFile="${dir}/.tmp/${1:t}" target="${dir}/${1:t}" @@ -25,7 +25,7 @@ EOF if [[ $(id -Gn) != *"$group"* ]]; then printf "Groups are ā€˜%sā€™. Trying to switch primary group to ā€˜%sā€™..." $(id -Gn) $group - exec -- @wrapperDir@/sg $group "$0 $*" + exec -- @wrapperdir@/sg $group "$0 $*" fi typeset -a failures @@ -40,13 +40,13 @@ failures=() @coreutils@/bin/touch -c -m -t "$2" "${target}" || failures+="touch" ) -if @doNotify@ && [[ $#failures -gt 0 ]]; then +if @donotify@ && [[ $#failures -gt 0 ]]; then printf "%s\n%s\n%s" "${target:t}" "Failed to download" ${(j:, :)failures} | @notify@ -a recv-media -u Critical fi -if @doNotify@; then +if @donotify@; then ( - if @showTitle@; then + 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=${target:t} diff --git a/custom/uucp-mediaclient.nix b/custom/uucp-mediaclient.nix index ab949150..7c7f2743 100644 --- a/custom/uucp-mediaclient.nix +++ b/custom/uucp-mediaclient.nix @@ -16,16 +16,17 @@ let ''; inherit zsh coreutils utillinux; - inherit (config.security) wrapperDir; - inherit (cfg) mediaDir; - doNotify = cfg.notify.users != []; + wrapperdir = config.security.wrapperDir; + mediadir = cfg.mediaDir; + donotify = cfg.notify.users != []; + showtitle = cfg.notify.extractTitle; ffmpeg = if doNotify then ffmpeg-full else "/no-such-path"; notify = writeScript "notify.sh" '' #!${zsh}/bin/zsh input=$(cat) - ${concatMapStringsSep "\n" (name: ''${wrapperDir}/notify-${name} $@ <<<''${input}'') cfg.notify.users} + ${concatMapStringsSep "\n" (name: ''${wrapperdir}/notify-${name} $@ <<<''${input}'') cfg.notify.users} ''; buildPhase = '' -- cgit v1.2.3