From 56c2b344e7809d17068341088e5bb0fe845c5621 Mon Sep 17 00:00:00 2001 From: Gregor Kleen Date: Wed, 18 Apr 2018 15:41:53 +0200 Subject: urldecode --- odin/strm/cleanup_youtube | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/odin/strm/cleanup_youtube b/odin/strm/cleanup_youtube index 76c3f0bb..03729b01 100644 --- a/odin/strm/cleanup_youtube +++ b/odin/strm/cleanup_youtube @@ -17,14 +17,14 @@ function cleanup { [[ -n "${tagFile}" ]] && rm -fv ${tagFile} } -urldecode() { : "${*//+/ }"; echo -e "${_//%/\\x}"; } +urldecode() { { local x="${*//+/ }"; echo -e "${x//\%/\\x}"; } $(cat) } @rollingdirectory@/bin/rolling-directory /srv/media/youtube 50Gi notmuch search --output=messages --format=text 'is:cached' | \ while read id; do untag=false - url=$(notmuch show --format=raw "$id" | grep 'http://odin.asgard.yggdrasil/youtube' | sed -r 's|^.*href="http://odin.asgard.yggdrasil/youtube/([^"]+)".*$|\1|' | urldecode) + url=$(notmuch show --format=raw "$id" | grep 'http://odin.asgard.yggdrasil/youtube' | sed -r 's|^.*href="http://odin.asgard.yggdrasil/youtube/([^"]+)".*$|\1|' | urldecode ) printf "%s\n ā€˜%sā€™\n" ${id} ${dir}/${url} -- cgit v1.2.3