summaryrefslogtreecommitdiff
path: root/odin/strm
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:32:36 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:32:36 +0200
commit2e13c35e55cace64537d41c4b202f9abf163387e (patch)
tree6fdb19d5dfe79fa0e479f51593b989c7eec544b0 /odin/strm
parent6f457860ffd4313109a19a57a776b3ec157c4d22 (diff)
downloadnixos-2e13c35e55cace64537d41c4b202f9abf163387e.tar
nixos-2e13c35e55cace64537d41c4b202f9abf163387e.tar.gz
nixos-2e13c35e55cace64537d41c4b202f9abf163387e.tar.bz2
nixos-2e13c35e55cace64537d41c4b202f9abf163387e.tar.xz
nixos-2e13c35e55cace64537d41c4b202f9abf163387e.zip
cache_media
Diffstat (limited to 'odin/strm')
-rw-r--r--odin/strm/cache_media26
1 files changed, 26 insertions, 0 deletions
diff --git a/odin/strm/cache_media b/odin/strm/cache_media
new file mode 100644
index 00000000..68938799
--- /dev/null
+++ b/odin/strm/cache_media
@@ -0,0 +1,26 @@
1#!@zsh@/bin/zsh
2
3logTag=${0:t}
4
5exec 1> >(logger -t "$logTag" -p news.notice)
6exec 2> >(logger -t "$logTag" -p news.error)
7
8debug() { logger -t "$logTag" -p news.debug }
9
10function notmuch {
11 msg1=1
12 while true; do
13 result=$(env NOTMUCH_CONFIG=${HOME}/.notmuch-rss-config @notmuch@/bin/notmuch $@)
14 if ! [[ "$result" =~ "already locked" ]]; then
15 echo -nE "$result"
16 return
17 else
18 [[ $msg1 == "1" ]] && echo "Already locked" >&2
19 msg1=0
20 fi
21 sleep 2
22 done
23}
24
25exec -- nice -n 5 -- ionice -n 5 -- xargs -d '\n' -n 1 -r -P 1 -- download_youtube \
26 <<<$(notmuch search --sort=oldest-first --output=messages --format=text "( tag:inbox AND is:media AND is:unread ) AND NOT ( tag:new OR tag:killed OR tag:failed OR tag:cached )") \