From c2133940ccb3fec4d65b1b559a32903cdaade9b8 Mon Sep 17 00:00:00 2001 From: kittenlikeasmallcat <75060689+ktnlikeasmallcat@users.noreply.github.com> Date: Fri, 21 Jan 2022 23:01:42 -0800 Subject: [PATCH] Add files via upload --- mutespotify | 138 ++++++++++++++++++++++++++++++++++++++++++++++++++++ nowplaying | 26 ++++++++++ 2 files changed, 164 insertions(+) create mode 100644 mutespotify create mode 100644 nowplaying diff --git a/mutespotify b/mutespotify new file mode 100644 index 0000000..4fe2058 --- /dev/null +++ b/mutespotify @@ -0,0 +1,138 @@ +#!/bin/bash +SONG=$( cat ~/.nowplaying2.tmp) + +send_mute(){ + local NOTMUTE=$(amixer get Master | sed 5q | grep -q '\[on\]' ) + local TOGGLE=$( pactl set-sink-mute @DEFAULT_SINK@ 1 ) + if $NOTMUTE; then $TOGGLE ; fi + } +send_unmute(){ + local ISMUTE=$( amixer get Master | sed 5q | grep -q '\[off\]' ) + local TOGGLE=$( pactl set-sink-mute @DEFAULT_SINK@ 0 ) + if $ISMUTE; then $TOGGLE; fi + } + +while : ; do + if ! $(pgrep -x "spotify" >/dev/null) ; then + #echo "error 1"; + echo -n "spotify is off as fuck" > ~/.nowplaying2.tmp + #exec bash "$0" "$@" + elif $(pidof -x "spotify">/dev/null ) ; then + echo -n $( spotifycli --song ) > ~/.nowplaying2.tmp ; + + case $SONG in + "Advertisement" ) + notify-send -t 2000 "🔇️ FUCK ADS 🔇️" && + send_mute ; + echo -n $( spotifycli --song ) > ~/.nowplaying2.tmp ; + #echo "AD IS HAPPENING"; + sleep 12 + exec bash "$0" "$@" + ;; + \n ) + echo -n "spotify is off as fuck" > ~/.nowplaying2.tmp + #echo "error3"; + sleep 30 + ;; + "spotify is off as fuck" ) + #echo "error4"; + send_unmute; + sleep 30 + ;; + * ) + #echo "PLAYNG"; + send_unmute; + echo -n $( spotifycli --song ) > ~/.nowplaying2.tmp ; + sleep 1 + exec bash "$0" "$@" + ;; + esac; + + else echo -n "spotify is off as fuck" > ~/.nowplaying2.tmp ; #IDK IF NEEDED + echo "error6"; + send_unmute; + fi; + +sleep 3; +#exec bash "$0" "$@" +done + + +##############backup##########backup####################### +# case $SONG in +# "Advertisement" ) +# echo "error2"; +# notify-send -t 700 " FUCK ADS " && +# send_mute +# echo -n $( spotifycli --song ) > ~/.nowplaying2.tmp ; +#sleep 1 ; +#exec bash "$0" "$@" +# ;; +# \n ) +# echo "AD IS HAPPENING"; +# echo -n "spotify is off as fuck" > ~/.nowplaying2.tmp +# send_unmute +#sleep 1 ; +#exec bash "$0" "$@" +# ;; +# "spotify is off as fuck" ) +# #echo "error4"; +# send_unmute +#sleep 1 ; +#exec bash "$0" "$@" +# ;; +# * ) +# #echo "error5"; +# send_unmute; +# echo -n $( spotifycli --song ) > ~/.nowplaying2.tmp ; +#sleep 1 ; +#exec bash "$0" "$@" +# ;; +# esac; +##############backup##########backup####################### + +# +#ISMUTE=$( amixer get Master | sed 5q | grep -q '\[off\]' ) +#NOTMUTE=$( amixer get Master | sed 5q | grep -q '\[on\]' ) +#SONG=$( tail ~/.nowplaying2.tmp) +# +#send_mute(){ +# local NOTMUTE=$( amixer get Master | sed 5q | grep -q '\[on\]' ) +# local TOGGLE=$( pactl set-sink-mute @DEFAULT_SINK@ 1 ) +#if $NOTMUTE; then notify-send " FUCK ADS MUTING THAT SHIT"; +#$TOGGLE; fi +#} +#send_unmute(){ +# local ISMUTE=$( amixer get Master | sed 5q | grep -q '\[off\]' ) +# local TOGGLE=$( pactl set-sink-mute @DEFAULT_SINK@ 0 ) +#if $ISMUTE; then $TOGGLE; fi +#} +# +#while : ; +#do +# if pgrep -x "spotify" >/dev/null +# then +# echo -n $( spotifycli --song ) > ~/.nowplaying2.tmp ; +# case $SONG in +# "Advertisement" ) +# send_mute ; +# #echo __ad ; +# sleep 28 +# continue +# ;; +# *) #TRY INVERING ALL THIS FROM $SONG AND MAKE SPOTOFF AN OPTION +# send_unmute ; +# #echo __notad ; +# sleep 1 +# continue +# ;; +# #3*) +# #echo SOMETHINGS FUCKED +# #;; +# esac +# else +# echo -n "spotify is off as fuck" > ~/.nowplaying2.tmp ; +# send_unmute ; +# fi; sleep 2 +#done +############################################################# diff --git a/nowplaying b/nowplaying new file mode 100644 index 0000000..7165629 --- /dev/null +++ b/nowplaying @@ -0,0 +1,26 @@ +#!/bin/bash +SONG=$( cat ~/.nowplaying2.tmp ) + #while :; do +if ! $(pgrep -x "spotify" >/dev/null) ; then + tail -z ~/.cmus/now-playing & echo -n $(np -n 2>/dev/null); + #echo "error1"; +elif $(pidof -x "spotify">/dev/null ) ; then + + case $SONG in + "Advertisement" ) + tail -z ~/.cmus/now-playing & echo -n $(np -n 2>/dev/null); + echo 'MUTED·' + #echo "error2"; + ;; + "spotify is off as fuck" ) + tail -z ~/.cmus/now-playing & echo -n $(np -n 2>/dev/null); + echo "error3"; + ;; + * ) + tail -z ~/.cmus/now-playing & echo -n $(np -n 2>/dev/null); + echo $(spotifycli --status) + #echo "error4"; + ;; + esac; +fi + #sleep 2; done