From 6d4bee5d17d4ffbfde73eb7d493b39c9a741637b Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Fri, 6 Apr 2018 14:36:19 +0200 Subject: cache_media --- odin/strm/cache_media | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) (limited to 'odin/strm/cache_media') diff --git a/odin/strm/cache_media b/odin/strm/cache_media index 68938799..8c345489 100644 --- a/odin/strm/cache_media +++ b/odin/strm/cache_media @@ -22,5 +22,15 @@ function notmuch { done } -exec -- nice -n 5 -- ionice -n 5 -- xargs -d '\n' -n 1 -r -P 1 -- download_youtube \ - <<<$(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 )") \ +while { + results=$(notmuch search --sort=oldest-first --output=messages "( tag:inbox AND is:media AND is:unread ) AND NOT ( tag:new OR tag:killed OR tag:failed OR tag:cached )") + ids=("${(f)results}") + for i in $checkedIds; do + ids=(${ids#$i}) + done + checkedIds=($checkedIds $ids) +} && [[ -n "${ids}" ]]; do + url="" + + xargs -d '\n' -n 1 -r -P 1 -- download_youtube <<<$(print -l ${ids}) +done -- cgit v1.2.3