scripts

unixus scriptus
git clone https://s.sonu.ch/~roket1428/scripts.git
Log | Files | Refs

music (459B)


      1 #!/bin/sh
      2 
      3 # cmus song script
      4 
      5 # Check if cmus is working
      6 if [ -n "$(pgrep -x cmus)" ]; then
      7 
      8 	artist=$(cmus-remote -Q | sed -ne 's/tag\ artist\ //p')
      9 	title=$(cmus-remote -Q | sed -ne 's/^.*title //p')
     10 	file=$(cmus-remote -Q | sed -ne 's/^.*\///p')
     11 
     12 	# if song has title metadata then use it else show file name
     13 	if [ -n "$title" ]; then
     14 		output="$artist - $title"
     15 	else
     16 		output="$file"
     17 	fi
     18 	
     19 	printf "%s \\n" "$output"
     20 else
     21 	echo "waiting for cmus..."
     22 fi