summaryrefslogtreecommitdiff
path: root/odin/strm
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-04-18 14:36:35 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-04-18 14:36:35 +0200
commit7e61a4b4f1184657289555d8112226c77ffcf1b7 (patch)
treedd4f0c53b343cf4428cb35e474b37cd696d96f4b /odin/strm
parent12ee11496fbb107abda7c40e7bb4b1cbcb8c942c (diff)
downloadnixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar.gz
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar.bz2
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.tar.xz
nixos-7e61a4b4f1184657289555d8112226c77ffcf1b7.zip
Nicer utils
Diffstat (limited to 'odin/strm')
-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