diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-06 14:26:03 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-06 14:26:03 +0200 |
commit | 941f35b76b3fda872745f8788f8546d979513bde (patch) | |
tree | 5566d0d1416cda86b39ea8e20f115c3a69a5a30b /odin/strm/send_kitty | |
parent | b3b957b92d66dcfa3452e377b1fa15b2342cd7b1 (diff) | |
download | nixos-941f35b76b3fda872745f8788f8546d979513bde.tar nixos-941f35b76b3fda872745f8788f8546d979513bde.tar.gz nixos-941f35b76b3fda872745f8788f8546d979513bde.tar.bz2 nixos-941f35b76b3fda872745f8788f8546d979513bde.tar.xz nixos-941f35b76b3fda872745f8788f8546d979513bde.zip |
send_kitty
Diffstat (limited to 'odin/strm/send_kitty')
-rwxr-xr-x | odin/strm/send_kitty | 41 |
1 files changed, 41 insertions, 0 deletions
diff --git a/odin/strm/send_kitty b/odin/strm/send_kitty new file mode 100755 index 00000000..a294d84c --- /dev/null +++ b/odin/strm/send_kitty | |||
@@ -0,0 +1,41 @@ | |||
1 | #!@zsh@/bin/zsh | ||
2 | |||
3 | set -o errexit | ||
4 | umask 022 | ||
5 | |||
6 | wDir=/srv/hlidskjalf | ||
7 | concatDir=${wDir}/concat | ||
8 | lastFile=${concatDir}/latest.mkv | ||
9 | |||
10 | fList="" | ||
11 | |||
12 | function cleanup() { | ||
13 | [[ -n "${fList}" ]] && rm -v ${fList} | ||
14 | } | ||
15 | |||
16 | trap cleanup EXIT | ||
17 | |||
18 | fList=$(mktemp --tmpdir filelist.XXXXXX) | ||
19 | |||
20 | typeset -a findArg | ||
21 | findArg=() | ||
22 | |||
23 | if [[ -e ${lastFile} ]]; then | ||
24 | findArg=(-mtime -1 -a -newer ${lastFile}) | ||
25 | else | ||
26 | findArg=(-mtime -1) | ||
27 | fi | ||
28 | |||
29 | find -L /srv/hlidskjalf \( -path /srv/hlidskjalf/concat -prune \) -o \( \( ${findArg} \) -type f -print \) | sort | >! ${fList} | ||
30 | |||
31 | cat ${fList} >&2 | ||
32 | |||
33 | if [[ $(wc -l ${fList} | cut -d ' ' -f 1) -eq 0 ]]; then | ||
34 | exit 0 | ||
35 | fi | ||
36 | |||
37 | newFile="${concatDir}/$(date +'%Y-%m-%d-%H-%M-%S').mkv" | ||
38 | |||
39 | @ffmpeg@/bin/ffmpeg -safe 0 -f concat -i =(awk $'{ print "file \'"$0"\'" }' ${fList}) -c copy -metadata "description=$(xargs -a ${fList} -- basename -s ".mkv")" ${newFile} | ||
40 | queue.hel ${newFile} | ||
41 | ln -vfs $(realpath --relative-to=${lastFile:h} ${newFile}) ${lastFile} | ||