summaryrefslogtreecommitdiff
path: root/odin
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:26:03 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:26:03 +0200
commit941f35b76b3fda872745f8788f8546d979513bde (patch)
tree5566d0d1416cda86b39ea8e20f115c3a69a5a30b /odin
parentb3b957b92d66dcfa3452e377b1fa15b2342cd7b1 (diff)
downloadnixos-941f35b76b3fda872745f8788f8546d979513bde.tar
nixos-941f35b76b3fda872745f8788f8546d979513bde.tar.gz
nixos-941f35b76b3fda872745f8788f8546d979513bde.tar.bz2
nixos-941f35b76b3fda872745f8788f8546d979513bde.tar.xz
nixos-941f35b76b3fda872745f8788f8546d979513bde.zip
send_kitty
Diffstat (limited to 'odin')
-rw-r--r--odin/strm.nix3
-rwxr-xr-xodin/strm/send_kitty41
2 files changed, 43 insertions, 1 deletions
diff --git a/odin/strm.nix b/odin/strm.nix
index 36d0e876..9ddec319 100644
--- a/odin/strm.nix
+++ b/odin/strm.nix
@@ -12,11 +12,12 @@ stdenv.mkDerivation {
12 substituteAllInPlace download_youtube 12 substituteAllInPlace download_youtube
13 substituteAllInPlace cleanup_youtube 13 substituteAllInPlace cleanup_youtube
14 substituteAllInPlace send_media 14 substituteAllInPlace send_media
15 substituteAllInPlace send_kitty
15 ''; 16 '';
16 17
17 installPhase = '' 18 installPhase = ''
18 mkdir -p $out/bin 19 mkdir -p $out/bin
19 20
20 install -m 755 -t $out/bin download_youtube cleanup_youtube send_media 21 install -m 755 -t $out/bin download_youtube cleanup_youtube send_media send_kitty
21 ''; 22 '';
22} 23}
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
3set -o errexit
4umask 022
5
6wDir=/srv/hlidskjalf
7concatDir=${wDir}/concat
8lastFile=${concatDir}/latest.mkv
9
10fList=""
11
12function cleanup() {
13 [[ -n "${fList}" ]] && rm -v ${fList}
14}
15
16trap cleanup EXIT
17
18fList=$(mktemp --tmpdir filelist.XXXXXX)
19
20typeset -a findArg
21findArg=()
22
23if [[ -e ${lastFile} ]]; then
24 findArg=(-mtime -1 -a -newer ${lastFile})
25else
26 findArg=(-mtime -1)
27fi
28
29find -L /srv/hlidskjalf \( -path /srv/hlidskjalf/concat -prune \) -o \( \( ${findArg} \) -type f -print \) | sort | >! ${fList}
30
31cat ${fList} >&2
32
33if [[ $(wc -l ${fList} | cut -d ' ' -f 1) -eq 0 ]]; then
34 exit 0
35fi
36
37newFile="${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}
40queue.hel ${newFile}
41ln -vfs $(realpath --relative-to=${lastFile:h} ${newFile}) ${lastFile}