Files
dotfiles/.conky/music/format.sh
2019-11-03 15:04:22 +01:00

17 lines
653 B
Bash
Executable File

#!/bin/bash
width=26
space=' ' #20 spaces
if [ -f $META_FILE ]; then
artist=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="xesam:artist") print $(i+2)}')
album=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="xesam:album") print $(i+2)}')
title=$(cat ~/.conky/music/meta | awk -F \' '{for(i=1;i<=NF;i++) if ($i=="xesam:title") print $(i+2)}')
out=$(echo "$artist"; echo "$title"; echo "$album")
out=$(echo "$out" | fmt -s --width $width)
mapfile -t var <<< "$out"
for word in "${var[@]}"; do
echo "$space $word"
done
else
echo "Nothing playing"
fi