summaryrefslogtreecommitdiff
path: root/odin/strm/cleanup_youtube
diff options
context:
space:
mode:
Diffstat (limited to 'odin/strm/cleanup_youtube')
-rw-r--r--odin/strm/cleanup_youtube14
1 files changed, 1 insertions, 13 deletions
diff --git a/odin/strm/cleanup_youtube b/odin/strm/cleanup_youtube
index 2d91fe1f..76c3f0bb 100644
--- a/odin/strm/cleanup_youtube
+++ b/odin/strm/cleanup_youtube
@@ -19,19 +19,7 @@ function cleanup {
19 19
20urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } 20urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
21 21
22dir=/srv/media/youtube 22@rollingdirectory@/bin/rolling-directory /srv/media/youtube 50Gi
23maxsize=$((1024 * 1024 * 1024 * 50))
24
25while [[ $(du -bs $dir | awk '{ print $1; }') -gt $maxsize ]]; do
26 find $dir -type f -not -path $dir/CACHEDIR.TAG -print0 | \
27 xargs -0 -- stat --printf '%W %Y %Z %X %n\0' | \
28 sort -t '\0' -z | \
29 awk -F '\0' '{ gsub("^\\S+\\s+\\S+\\s+\\S+\\s+\\S+\\s+", "", $1); printf "%s\0", $1; }' | \
30 xargs -0 -- rm -v
31done
32
33find $dir -xtype l -delete
34find $dir -type d -empty -delete
35 23
36notmuch search --output=messages --format=text 'is:cached' | \ 24notmuch search --output=messages --format=text 'is:cached' | \
37 while read id; do 25 while read id; do