From 9abeefdf036271f32d9745068cfccf74c7c66e80 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Tue, 11 Sep 2018 12:23:39 +0200 Subject: move tmpfile into place --- odin/strm/send_kitty | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) (limited to 'odin/strm/send_kitty') diff --git a/odin/strm/send_kitty b/odin/strm/send_kitty index 2b3e017b..e4139885 100644 --- a/odin/strm/send_kitty +++ b/odin/strm/send_kitty @@ -10,9 +10,11 @@ concatDir=${wDir}/concat lastFile=${concatDir}/latest.mkv fList="" +tmpFile="" function cleanup() { - [[ -n "${fList}" ]] && rm -v ${fList} + [[ -n "${fList}" ]] && rm -fv ${fList} + [[ -n "${tmpFile}" ]] && rm -fv ${tmpFile} } trap cleanup EXIT @@ -37,7 +39,9 @@ if [[ $(wc -l ${fList} | cut -d ' ' -f 1) -eq 0 ]]; then fi newFile="${concatDir}/hlidskjalf.$(date +'%Y-%m-%d-%H-%M-%S').mkv" +tmpFile=$(mktemp --tmpdir ${concatDir} "${newfile:h}/.${newFile:t:r}.XXXXXX.mkv") -ffmpeg -safe 0 -f concat -i =(awk $'{ print "file \'"$0"\'" }' ${fList}) -c:v libx264 -r 30 -crf 27 -preset veryfast -vf 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2' -metadata "description=$(xargs -a ${fList} -- basename -s ".mkv")" ${newFile} +ffmpeg -safe 0 -f concat -i =(awk $'{ print "file \'"$0"\'" }' ${fList}) -c:v libx264 -r 30 -crf 27 -preset veryfast -vf 'scale=1920:1080:force_original_aspect_ratio=decrease,pad=1920:1080:(ow-iw)/2:(oh-ih)/2' -metadata "description=$(xargs -a ${fList} -- basename -s ".mkv")" ${tmpFile} +mv -v ${tmpFile} ${newFile} queue.hel -p -r ${newFile} ln -vfs $(realpath --relative-to=${lastFile:h} ${newFile}) ${lastFile} -- cgit v1.2.3