1
0
mirror of https://github.com/Foltik/dotfiles synced 2024-12-10 21:48:09 -05:00
dotfiles/cfg/i3blocks/laptop/blocks/cmus
2017-07-26 11:05:09 -07:00

21 lines
531 B
Bash
Executable File

#!/bin/bash
INFO_CMUS=$(cmus-remote -Q 2>/dev/null)
if [[ $? -eq 0 ]]; then
INFO_TITLE=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*title//p' | head -n 1)
INFO_ALBUM=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*album//p' | head -n 1)
INFO_ARTIST=$(echo "${INFO_CMUS}" | sed -n -e 's/^.*artist//p' | head -n 1)
else
exit
fi
if [[ "${INFO_ARTIST}" ]] && [[ "${INFO_TITLE}" ]]; then
OUT_TEXT="${INFO_ARTIST} - ${INFO_TITLE}"
elif [[ "${INFO_TITLE}" ]]; then
OUT_TEXT="${INFO_TITLE}"
fi
echo "${OUT_TEXT}"
echo "${OUT_TEXT}"
exit