From 915d06f63a24472933ccc34e51ce9e769576fa88 Mon Sep 17 00:00:00 2001 From: kittenlikeasmallcat <75060689+ktnlikeasmallcat@users.noreply.github.com> Date: Tue, 18 Jan 2022 14:00:06 -0800 Subject: [PATCH] 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. --- cscnp.sh | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) create mode 100644 cscnp.sh diff --git a/cscnp.sh b/cscnp.sh new file mode 100644 index 0000000..a1e66df --- /dev/null +++ b/cscnp.sh @@ -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 + +