Add files via upload

Needs np https://github.com/makos/clementine-np , a modified https://github.com/cmus/cmus/wiki/status_display_short_text.sh and spotifycli https://github.com/pwittchen/spotify-cli-linux to work completely. v1 NOT REFRESHING DISPLAY AFTER FIRST AD.
This commit is contained in:
kittenlikeasmallcat 2022-01-18 14:00:06 -08:00 committed by GitHub
parent d35192c180
commit 915d06f63a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

59
cscnp.sh Normal file
View file

@ -0,0 +1,59 @@
#!/bin/bash
## ~/.local/bin/5nowplaying.sh ##
ad(){ #is spotify trying to sell me something and calling it a song?
local SONG=$( eval spotifycli --song )
test
[[ $SONG == "Advertisement" ]]
}
checkmute(){ # am I muted already? returns 1 if unmuted. !checkmute means muted
test
[[ $( eval amixer -D pulse sget Master | grep -F [on] ) ]]
}
ifad(){ #prints now playing for clementine, "muted," and cmus
local C=$( np -n )
local M="MUTED ·"
local CMUS=$( tail -n 1 ~/.cmus/now-playing )
echo -n $C $M $CMUS
}
ifnoad(){ #prints now playing for clementine, spotify, and cmus
local C=$( np -n )
local S=$( spotifycli --status )
local CMUS=$( tail -n 1 ~/.cmus/now-playing )
echo -n $C $S $CMUS
}
if ad ; then ifad ;
elif ! ad ; then ifnoad;
else ifnoad ; fi #something's gone wrong
while ad && checkmute ; #if there's an ad and alsa is unmuted, runs fuckads.sh
do
# fuckads.sh #
toggle(){ #flip the switch
amixer -q -D pulse sset Master toggle
}
if ad ; then #yea spotify is trying to sell me something
while ad ; #right now?
do
if checkmute ; #am I muted yet?
then
toggle && notify-send "🔇FUCKADS🔇 MUTING THAT SHIT" ; #mute
sleep 30 #each ad is like 30 secs
fi; continue; # another one ??
done;
while ! ad ; #ok spotify isn't trying to sell me something
do
if ! checkmute ; #am I still muted?
then
toggle && notify-send "✅FUCKADS✅ MUTED THAT SHIT" ; #unmute
sleep 30 #wait to check for another ad
fi
done
fi
break; sleep 30 ; done #waits 30 seconds before checking and unmuting