{ stdenv , coreutils , writeScriptBin , eject , shadow , notifyUser ? "gkleen" , showTitle ? true , ffmpeg ? null , gnused ? null , wrapperDir ? "/run/wrappers/bin" }: assert showTitle -> ffmpeg != null && gnused != null && notifyUser != null; writeScriptBin "recv-media" '' #!${stdenv.shell} pid=$? notify=${if notifyUser == null then "false" else "true"} notifyUser=${if notifyUser == null then "" else notifyUser} PATH=${eject}/bin:${coreutils}/bin:${shadow}/bin:${if showTitle then ''${ffmpeg}/bin:${gnused}/bin:'' else ""}${wrapperDir} exec 1> >(logger --id=$pid -t recv-media -p user.notice) exec 2> >(logger --id=$pid -t recv-media -p user.error) [[ -z "$1" || -z "$2" ]] && exit 2 dir=/var/media group=$(stat -c '%G' $dir) tmpFile="''${dir}"/.tmp/$(basename "$1") target="''${dir}"/$(basename "$1") logger --id=$pid -t recv-media -p user.debug </dev/null | sed -r '/^\[CHAPTER\]$/q; /^title=/!d; s/^title=//')'' else ''""''} [[ -z "''${summary}" ]] && summary=$(basename "$1") printf "%s\n%s\n" "''${summary}" "" | notify-''${notifyUser} -a recv-media || true ) || true fi ''