Adds mpv radio block
This commit is contained in:
		
							parent
							
								
									782795779b
								
							
						
					
					
						commit
						707294cc42
					
				
					 3 changed files with 29 additions and 7 deletions
				
			
		| 
						 | 
				
			
			@ -10,16 +10,16 @@ case $BLOCK_BUTTON in
 | 
			
		|||
esac
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if [ "$($COMMAND status)" = "Playing" ]; then
 | 
			
		||||
if [ "$($COMMAND status 2> /dev/null )" = "Playing" ]; then
 | 
			
		||||
	colour="#00FF00"
 | 
			
		||||
else
 | 
			
		||||
	colour="#FF8000"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
title=$($COMMAND metadata title | sed "s/\&/\&/g")
 | 
			
		||||
artist=$($COMMAND metadata artist | sed "s/\&/\&/g")
 | 
			
		||||
title=$($COMMAND metadata title 2> /dev/null | sed "s/\&/\&/g")
 | 
			
		||||
artist=$($COMMAND metadata artist 2> /dev/null | sed "s/\&/\&/g")
 | 
			
		||||
 | 
			
		||||
if [ "$title" != "(null)" ]; then
 | 
			
		||||
if [ "$title" != "" ]; then
 | 
			
		||||
	ret="<span foreground='$colour'>$title</span>"
 | 
			
		||||
	if [ -n "$artist" ]; then
 | 
			
		||||
		ret="$ret - $artist"
 | 
			
		||||
| 
						 | 
				
			
			@ -28,5 +28,3 @@ if [ "$title" != "(null)" ]; then
 | 
			
		|||
	echo "$ret";
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								i3/blocks/mpvmediaplayer
									
										
									
									
									
										Executable file
									
								
							
							
						
						
									
										14
									
								
								i3/blocks/mpvmediaplayer
									
										
									
									
									
										Executable file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,14 @@
 | 
			
		|||
#!/usr/bin/sh
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
socket="${SOCKET:-/tmp/mpvsocket}"
 | 
			
		||||
 | 
			
		||||
#case $BLOCK_BUTTON in
 | 
			
		||||
#	1) $COMMAND previous ;;
 | 
			
		||||
#	3) $COMMAND next ;;
 | 
			
		||||
#esac
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
echo '{ "command": ["get_property_string", "filtered-metadata"] }' | socat - /tmp/mpvsocket | jq '.data' | sed 's/"{\\"icy-title\\":\\"//g' | sed 's/\\"}"//g'
 | 
			
		||||
echo ""
 | 
			
		||||
echo "#00FF00"
 | 
			
		||||
| 
						 | 
				
			
			@ -59,10 +59,20 @@ interval=5
 | 
			
		|||
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
 | 
			
		||||
[mediaplayer]
 | 
			
		||||
command=~/.dotfiles/i3/blocks/mediaplayer
 | 
			
		||||
instance=spotify
 | 
			
		||||
interval=2
 | 
			
		||||
signal=10
 | 
			
		||||
markup=pango
 | 
			
		||||
#separator=false
 | 
			
		||||
 | 
			
		||||
# MPV Player
 | 
			
		||||
#
 | 
			
		||||
# This displays "ARTIST - SONG" if a music is playing.
 | 
			
		||||
# Supported players are: spotify, vlc, audacious, xmms2, mplayer, and others.
 | 
			
		||||
[mpvmediaplayer]
 | 
			
		||||
command=~/.dotfiles/i3/blocks/mpvmediaplayer
 | 
			
		||||
SOCKET=/tmp/mpvsocket
 | 
			
		||||
interval=2
 | 
			
		||||
#markup=pango
 | 
			
		||||
 | 
			
		||||
#[proftpstatus]
 | 
			
		||||
#command=~/.dotfiles/i3/blocks/proftp
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue