blob: 22116e0d505860f2bd5ae00342cdccec69ffe6c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
#!/bin/bash
mpd_running=$(mpc 2>/dev/null | grep "\[playing\]")
spotify_running=$(./media_is_spotify_playing.sh)
if pgrep spotify &>/dev/null
then
if $spotify_running && [[ $mpd_running != "" ]]
then
echo spotify and mpd running
else
metadata=$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata')
if [[ $metadata == *"spotify:ad"* ]]
then
echo "Spotify: ad :/"
else
artist=$(echo "$metadata" | egrep -A 2 "artist" | egrep -v "artist" | egrep -v "array" | cut -b 27- | cut -d '"' -f 1 | egrep -v ^$)
title=$(echo "$metadata" | egrep -A 1 "title" | egrep -v "title" | cut -b 44- | cut -d '"' -f 1| egrep -v ^$)
if $spotify_running
then
pb_status="▶"
else
pb_status="▐▐"
fi
echo Spotify: $pb_status $artist - $title
fi
fi
elif pgrep mpd &>/dev/null
then
if type mpc &>/dev/null
then
if [[ $mpd_running != "" ]]
then
pb_status="▶"
else
pb_status="▐▐"
fi
echo MPD: $pb_status $(mpc current)
else
echo "for mpd status mpc is needed"
fi
else
echo no music
fi
|