diff options
author | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-06 14:32:36 +0200 |
---|---|---|
committer | Gregor Kleen <gkleen@yggdrasil.li> | 2018-04-06 14:32:36 +0200 |
commit | 2e13c35e55cace64537d41c4b202f9abf163387e (patch) | |
tree | 6fdb19d5dfe79fa0e479f51593b989c7eec544b0 /odin/strm | |
parent | 6f457860ffd4313109a19a57a776b3ec157c4d22 (diff) | |
download | nixos-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_media | 26 |
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 | |||
3 | logTag=${0:t} | ||
4 | |||
5 | exec 1> >(logger -t "$logTag" -p news.notice) | ||
6 | exec 2> >(logger -t "$logTag" -p news.error) | ||
7 | |||
8 | debug() { logger -t "$logTag" -p news.debug } | ||
9 | |||
10 | function 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 | |||
25 | exec -- 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 )") \ | ||