summaryrefslogtreecommitdiff
path: root/odin/strm/cleanup_youtube
diff options
context:
space:
mode:
authorGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:21:55 +0200
committerGregor Kleen <gkleen@yggdrasil.li>2018-04-06 14:21:55 +0200
commitbe500c469b5a6d8999bca710665dcbfdfd96282d (patch)
treee830f2809fb528aecf5f4ded7b7d658a4f96370e /odin/strm/cleanup_youtube
parenta8d02267bcaeb90e9933b63c666bf693158da154 (diff)
downloadnixos-be500c469b5a6d8999bca710665dcbfdfd96282d.tar
nixos-be500c469b5a6d8999bca710665dcbfdfd96282d.tar.gz
nixos-be500c469b5a6d8999bca710665dcbfdfd96282d.tar.bz2
nixos-be500c469b5a6d8999bca710665dcbfdfd96282d.tar.xz
nixos-be500c469b5a6d8999bca710665dcbfdfd96282d.zip
Diffstat (limited to 'odin/strm/cleanup_youtube')
-rwxr-xr-xodin/strm/cleanup_youtube4
1 files changed, 3 insertions, 1 deletions
diff --git a/odin/strm/cleanup_youtube b/odin/strm/cleanup_youtube
index 694487a5..2d91fe1f 100755
--- a/odin/strm/cleanup_youtube
+++ b/odin/strm/cleanup_youtube
@@ -17,6 +17,8 @@ function cleanup {
17 [[ -n "${tagFile}" ]] && rm -fv ${tagFile} 17 [[ -n "${tagFile}" ]] && rm -fv ${tagFile}
18} 18}
19 19
20urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; }
21
20dir=/srv/media/youtube 22dir=/srv/media/youtube
21maxsize=$((1024 * 1024 * 1024 * 50)) 23maxsize=$((1024 * 1024 * 1024 * 50))
22 24
@@ -34,7 +36,7 @@ find $dir -type d -empty -delete
34notmuch search --output=messages --format=text 'is:cached' | \ 36notmuch search --output=messages --format=text 'is:cached' | \
35 while read id; do 37 while read id; do
36 untag=false 38 untag=false
37 url=$(notmuch show --format=raw "$id" | grep 'http://odin.asgard.yggdrasil/youtube' | sed -r 's|^.*href="http://odin.asgard.yggdrasil/youtube/([^"]+)".*$|\1|' | sed -f /usr/lib/url_unescape.sed) 39 url=$(notmuch show --format=raw "$id" | grep 'http://odin.asgard.yggdrasil/youtube' | sed -r 's|^.*href="http://odin.asgard.yggdrasil/youtube/([^"]+)".*$|\1|' | urldecode)
38 40
39 printf "%s\n ‘%s’\n" ${id} ${dir}/${url} 41 printf "%s\n ‘%s’\n" ${id} ${dir}/${url}
40 42