View difference between Paste ID: WaxZR9Gq and QGsFkfAX
SHOW: | | - or go back to the newest paste.
1
#!/bin/bash
2-
## Script to push 'now playing' from cmus to conky. Fixed to stop the Album Artist being displayed by accident.
2+
## Script to push 'now playing' from cmus to conky. Fixed to stop the Album Artist and other things being displayed by accident.
3
## Updated to be more foolproof.
4-
if [ ! -x /usr/bin/cmus-remote ];
4+
5-
then
5+
if [ ! -x /usr/bin/cmus-remote ]; then
6-
echo "cmus is not installed."
6+
    echo "cmus is not installed."
7-
exit
7+
    exit
8
fi
9
10-
# The only change is in the below line, 'grep -v albumartist' has been added.
10+
# The below lines now search specifically for "tag foo".
11-
ARTIST=$( cmus-remote -Q 2>/dev/null | grep -v albumartist | grep artist | cut -d " " -f 3- )
11+
ARTIST=$( cmus-remote -Q 2>/dev/null | grep "tag artist" | cut -d " " -f 3- )
12-
TITLE=$( cmus-remote -Q 2>/dev/null | grep title | cut -d " " -f 3- )
12+
TITLE=$( cmus-remote -Q 2>/dev/null | grep "tag title" | cut -d " " -f 3- )
13
14-
if [ -z "$ARTIST" ];
14+
if [ -z "$ARTIST" ]; then
15-
then
15+
    echo "Nothing"
16-
echo "Nothing"
16+
17
    echo "$ARTIST - $TITLE"
18-
echo "$ARTIST - $TITLE"
18+