aboutsummaryrefslogtreecommitdiff
path: root/scripts/media_status.sh
blob: 8a65b4eb21d08ef63aecec7d30742717fdc2ec4b (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
#!/bin/sh
mpd_playing=$(mpc 2>/dev/null | grep "\[playing\]")
spotify_playing=$($DOTFILES_LOCATION/scripts/media_is_spotify_playing.sh)

if [[ $spotify_playing == "true" ]] 
then
    if [[ $mpd_playing != "" ]]
    then
        echo spotify and mpd playing
    else
        pb_status=""

        if [[ $metadata == *"spotify:ad"* ]]
        then
            echo "Spotify: ad :/"
        else
            echo Spotify: "▶" $($DOTFILES_LOCATION/scripts/media_print_spotify_info.sh)
        fi
    fi
elif [[ $mpd_playing != "" ]]
then
    if type mpc &>/dev/null
    then
        echo MPD: "▶" $(mpc current)
    else
        echo "for mpd status mpc is needed"
    fi
elif pgrep spotify &>/dev/null
then
    echo Spotify: "▐▐" $($DOTFILES_LOCATION/scripts/media_print_spotify_info.sh)
elif pgrep mpd &>/dev/null
then
    if type mpc &>/dev/null
    then
        current_song=$(mpc current)
        if test -n "$current_song"
        then
            echo "MPD: ▐▐ $current_song"
        fi
    else
        echo "for mpd status mpc is needed"
    fi
else
    echo no music
fi