Generates and manages static html of mpd currently playing music.

git clone git://watertao.xyz/programs/mpdhh.git

commit 38b98a43168772df8bfd83265c301d32b224dc2a
parent e9899294f9ad984950b294c45162e2fc22eae55b
Author: Jeff <dev@watertao.xyz>
Date:   Sun, 21 Apr 2024 21:47:08 -0700

Fixed live/realtime analysis bug

mpdhh.sh

When running in mode 0, analysis_update broke on strings with
ampersands. This was due to a shell regex breaking. Removed
and replaced the regex test on empty or dashed strings with a
grep test. Working well now.

Diffstat:
Mmpdhh.sh | 10+++++-----
1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/mpdhh.sh b/mpdhh.sh @@ -317,7 +317,8 @@ __update_analysis_sort(){ # If track not in db, add it - if [ "$track_match" -ne 0 ]; then + if [ "$track_match" -ne 0 ] + then printf "Updating %s..." "${1##*/}" # Get new count @@ -327,11 +328,10 @@ __update_analysis_sort(){ printf "done.\n" else # Track no exist, add it, then sort - printf "Adding to %s..." "${1##*/}" + printf "%s\n" "Adding to ${1##*/}..." a="$(printf "%s" "$track_data" | cut -f "$2")" - regex="^[- ]$" - if [[ ! "$a" =~ $regex ]]; then - + if printf "%s" "$a" | grep -q -v "^[- ]$" + then printf "%s\t%s\t%s\t%s\n" "$a" "$played_date" "$played_date" "1" >> "$1" sort -n -o "$1" "$1" fi