30 lines
481 B
Bash
30 lines
481 B
Bash
|
#! /bin/sh
|
||
|
MAX_SONG_LEN=45
|
||
|
MAX_ARTIST_LEN=30
|
||
|
|
||
|
song=$(playerctl metadata title 2>/dev/null)
|
||
|
if [ "$song" = "" ]
|
||
|
then
|
||
|
echo " "
|
||
|
exit
|
||
|
fi
|
||
|
short_song=$(echo $song | head -c $MAX_SONG_LEN)
|
||
|
if [ "$song" = "$short_song" ]
|
||
|
then
|
||
|
echo -n
|
||
|
else
|
||
|
song="$short_song..."
|
||
|
fi
|
||
|
|
||
|
artist=$(playerctl metadata artist)
|
||
|
short_artist=$(echo $artist | head -c $MAX_ARTIST_LEN)
|
||
|
if [ "$artist" = "$short_artist" ]
|
||
|
then
|
||
|
echo -n
|
||
|
else
|
||
|
artist="$short_artist..."
|
||
|
fi
|
||
|
|
||
|
echo $song - $artist
|
||
|
#echo $song
|