From 0d5b6c1d0cbe814a4c3819353d5aba8a1c6facaf Mon Sep 17 00:00:00 2001 From: =?utf8?q?Paul=20H=C3=A4nsch?= Date: Tue, 16 Nov 2021 01:30:03 +0100 Subject: [PATCH] quicker tag collection --- widgets.sh | 25 ++++++++----------------- 1 file changed, 8 insertions(+), 17 deletions(-) mode change 100644 => 100755 widgets.sh diff --git a/widgets.sh b/widgets.sh old mode 100644 new mode 100755 index 6af562e..35b485a --- a/widgets.sh +++ b/widgets.sh @@ -14,23 +14,14 @@ c_tags="$_DATA/.index/tags.cache"; c_tagcategories="$_DATA/.index/tagcategories. if [ ! -s "$c_tags" -o ! -s "$c_tagcategories" ] \ || [ "$(find "$_DATA/" -path '*/.index/meta' -newer "$c_tags")" ] then - w_tags="$( cn=1 - find "$_DATA/" -path '*/.index/meta' -print0 \ - | xargs -0 -r sed -E ' - s;^.*\t.*\t.*\ttags=(.*)\tcomment=.*\t.*\r$;\1;; - s;,;\n;g;' \ - | { sort; printf '\n'; } \ - | while read -r tag; do - if [ "$tag" = "$otag" ]; then - cn=$((cn + 1)) - else - printf "%i %s\n" "$cn" "$(UNSTRING "$otag")" - cn=1 - fi - otag="$tag" - done \ - |sort -rn |cut -f2- |HTML \ - |sed "s- -\n-g; s;\n\n;\n;g;" + w_tags="$( + list_meta |sed -E ' + s;^.*\ttags=([^\t]*)\t.*$;\1;; + s;,;\n;g; + ' \ + | sort |uniq -c |sed -E 's;^ *[0-9]+ ;;;' |sort -rn \ + | UNSTRING | HTML \ + | sed -E 's; \;;\n;g; s;\n+;\n;g;' )" w_tagcategories="$(printf %s "$w_tags" | sed -rn '/:/s;^-?([^:]+):.*$;\1;p' |sort -u )" printf %s "$w_tags" >"$c_tags" -- 2.39.2