Revisions
-
logical-and revised this gist
Nov 14, 2020 . 1 changed file with 2 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,11 +4,13 @@ This is for testing purposes ONLY! Spotify is a fantastic service and worth ever ## Usage ```bash wget -O spotify-mute-ads.sh https://gist.githubusercontent.com/logical-and/825bab160d604d82bf6ad9ebd3a6410d/raw/84f77518f6fa8980e73fcf1fadd30d223f2100a1/spotify-mute-ads.sh chmod ug+x spotify-mute-ads.sh ./spotify-mute-ads.sh # - OR nohup ./spotify-mute-ads.sh > /tmp/spotify_mute.log ``` ## Dependencies Utilities used in the script: -
logical-and revised this gist
Nov 14, 2020 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,7 +4,7 @@ This is for testing purposes ONLY! Spotify is a fantastic service and worth ever ## Usage wget -O spotify-mute-ads.sh https://gist.githubusercontent.com/logical-and/825bab160d604d82bf6ad9ebd3a6410d/raw/84f77518f6fa8980e73fcf1fadd30d223f2100a1/spotify-mute-ads.sh chmod ug+x spotify-mute-ads.sh ./spotify-mute-ads.sh # - OR -
logical-and revised this gist
Nov 14, 2020 . 2 changed files with 9 additions and 4 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -4,8 +4,11 @@ This is for testing purposes ONLY! Spotify is a fantastic service and worth ever ## Usage wget -O spotify-mute-ads.sh https://gist.githubusercontent.com/logical-and/825bab160d604d82bf6ad9ebd3a6410d/raw/42d681bd8c6995c534c386718dd7914a6d5f0709/spotify-mute-ads.sh chmod ug+x spotify-mute-ads.sh ./spotify-mute-ads.sh # - OR nohup ./spotify-mute-ads.sh > /tmp/spotify_mute.log ## Dependencies Utilities used in the script: This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,8 +1,10 @@ #!/bin/bash # Mute spotify when it starts advertisement # Run like this # nohup ./spotify-mute-ads.sh > /tmp/spotify_mute.log & # or # ./spotify-mute-ads.sh # Link: https://gist.githubusercontent.com/logical-and/825bab160d604d82bf6ad9ebd3a6410d/raw/42d681bd8c6995c534c386718dd7914a6d5f0709/spotify-admute.sh # Link: https://gist.github.com/pcworld/3198763/af2a4981c6f26075c0a16a261f5294f2cf5e5da5#gistcomment-3384837 # Settings -
logical-and revised this gist
Nov 14, 2020 . 3 changed files with 116 additions and 52 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,24 @@ We all love Spotify, but sometimes people (like us) want to throw a party without having to listen to interrupting ads before having bought Spotify Premium. Well, with this killer project, now you can! This is for testing purposes ONLY! Spotify is a fantastic service and worth every penny. This script is NOT meant to circumvent buying premium! Please do consider switching to premium to support Spotify - especially if you're going to use it on mobile. If the script does not work for you, help us improve it! ## Usage git clone nohup bash ~/bin/spotify/mute.sh > /tmp/spotify_mute.log ## Dependencies Utilities used in the script: * xprop * pacmd * xdotool # Credits This script is based on: * https://gist.github.com/pcworld/3198763 * https://gist.github.com/pcworld/3198763/af2a4981c6f26075c0a16a261f5294f2cf5e5da5#gistcomment-3384837 * https://github.com/SecUpwN/Spotify-AdKiller (took description from there :)) Thank y'all guys! This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,3 +0,0 @@ This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,51 +1,94 @@ #!/bin/bash # Based on https://gist.github.com/pcworld/3198763 # Mute spotify when it starts advertisement # Run like this # nohup bash ~/bin/spotify/mute.sh > /tmp/spotify_mute.log & # Link: https://gist.github.com/pcworld/3198763/af2a4981c6f26075c0a16a261f5294f2cf5e5da5#gistcomment-3384837 # Settings PAUSE_BEFORE_UNMUTE=2 PAUSE_NOT_ACTIVE=5 # VAR AD_MUTED=0 AD_DETECTED=0 # FCT get_pactl_nr() { pactl list | grep -E '(^Sink Input)|(media.name = \"Spotify\"$)' | cut -d \# -f2 \ | grep -v Spotify } mute_player() { num=$(pactl list | grep -E '(^Sink Input)|(media.name = \"Spotify\"$)' | awk '/Spotify/ {print a} {a = $0}' | cut -c 13- | tail -n 1) pactl set-sink-input-mute $num yes } unmute_player() { num=$(pactl list | grep -E '(^Sink Input)|(media.name = \"Spotify\"$)' | awk '/Spotify/ {print a} {a = $0}' | cut -c 13- | tail -n 1) pactl set-sink-input-mute $num no } log() { local line=${1} echo \[$( date "+%H:%M:%S" )\] $line } # Unmute just in case this script crashed the previous time unmute_player # Endless loop, sort of service while [ 1 ]; do # Find window id WM_ID=$(xdotool search --class "spotify" | sed -n 2p) if [ -z "$WM_ID" ]; then log "Spotify not active" sleep $PAUSE_NOT_ACTIVE continue fi # MAIN xprop -spy -id "$WM_ID" WM_NAME | while read -r XPROPOUTPUT; do XPROP_TRACKDATA="$(echo "$XPROPOUTPUT" | cut -d \" -f 2 )" DBUS_TRACKDATA="$(dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 \ org.freedesktop.DBus.Properties.Get string:'org.mpris.MediaPlayer2.Player' string:'Metadata' | grep xesam:title -A 1 | grep variant | cut -d \" -f 2)" if [[ "$DBUS_TRACKDATA" =~ ^(Advertisement|Spotify)$ ]]; then log "AD detected" AD_DETECTED="1" else AD_DETECTED="0" log "No AD detected" fi # Debug (uncomment if you need to debug the script) # echo "XPROP: \"$XPROP_TRACKDATA\"" # echo "DBUS: \"$DBUS_TRACKDATA\"" # echo "Debug: AD_MUTED = $AD_MUTED, AD_DETECTED = $AD_DETECTED" if [[ "$AD_DETECTED" = "0" ]] && [[ "$AD_MUTED" = "1" ]]; then log "Unmuting (AD_MUTED = $AD_MUTED, AD_DETECTED = $AD_DETECTED)" sleep $PAUSE_BEFORE_UNMUTE unmute_player AD_MUTED="0" log "Unmuted" elif [[ "$AD_DETECTED" = "1" ]] && [[ "$AD_MUTED" = "0" ]]; then log "Muting (AD_MUTED = $AD_MUTED, AD_DETECTED = $AD_DETECTED)" mute_player AD_MUTED="1" log "Muted" fi done log "Spotify is not active, unmuting" unmute_player AD_MUTED="1" done log "Something went wrong. Exiting." exit 1 -
pcworld revised this gist
Jun 10, 2016 . 1 changed file with 3 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,3 @@ This script only works for older versions of Spotify for Linux. An actively developed admute script for Spotify on Linux can be found here: https://github.com/SecUpwN/Spotify-AdKiller -
pcworld revised this gist
Jul 8, 2013 . 1 changed file with 1 addition and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -8,8 +8,7 @@ #On Debian, you need the package "pulseaudio-utils" for the command line util "pactl" which used in this script # #Update: For newer 0.8.x versions (x>4; such as 0.8.8), use this script: https://gist.github.com/pcworld/3198763/#comment-813440 #For 0.9.x: https://gist.github.com/pcworld/3198763/#comment-857143 # #Copyright (c) 2012, "pcworld", 0188801@gmail.com #All rights reserved. -
pcworld revised this gist
May 10, 2013 . 1 changed file with 4 additions and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -7,6 +7,10 @@ #Find updated versions at: http://pcworldsoftware.kilu.net/files/link_spotify-admute.php and/or https://gist.github.com/pcworld #On Debian, you need the package "pulseaudio-utils" for the command line util "pactl" which used in this script # #Update: For newer 0.8.x versions (x>4; such as 0.8.8), use this script: https://gist.github.com/pcworld/3198763/#comment-813440 #There is currently no script for 0.9.x, see this comment here: https://gist.github.com/pcworld/3198763/#comment-826336, so it #might be a good idea not to upgrade, or to obtain an older version of Spotify. # #Copyright (c) 2012, "pcworld", 0188801@gmail.com #All rights reserved. # -
pcworld revised this gist
Aug 5, 2012 . 1 changed file with 2 additions and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -5,6 +5,7 @@ #To open Spotify, run it instead of the "spotify" binary. #System sound will be muted as soon as an ad plays #Find updated versions at: http://pcworldsoftware.kilu.net/files/link_spotify-admute.php and/or https://gist.github.com/pcworld #On Debian, you need the package "pulseaudio-utils" for the command line util "pactl" which used in this script # #Copyright (c) 2012, "pcworld", 0188801@gmail.com #All rights reserved. @@ -44,4 +45,4 @@ while read -r line ; do done & $DIR/spotify "$@" & wait $! && test -z "`jobs -p`" || kill `jobs -p` # http://stackoverflow.com/a/2618497 -
pcworld renamed this gist
Jul 29, 2012 . 1 changed file with 0 additions and 0 deletions.There are no files selected for viewing
File renamed without changes. -
pcworld renamed this gist
Jul 29, 2012 . 1 changed file with 9 additions and 2 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -1,6 +1,8 @@ #!/bin/bash #Linux Spotify Ad Mute v2 #Put this script in the directory the "spotify" binary is in (e.g. /usr/share/spotify). #To open Spotify, run it instead of the "spotify" binary. #System sound will be muted as soon as an ad plays #Find updated versions at: http://pcworldsoftware.kilu.net/files/link_spotify-admute.php and/or https://gist.github.com/pcworld # @@ -29,6 +31,8 @@ #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )" # http://stackoverflow.com/a/246128 dbus-monitor "type='signal',path='/org/mpris/MediaPlayer2',member='PropertiesChanged'" | grep --line-buffered 'string "Metadata"' | while read -r line ; do if ! [[ "`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify / org.freedesktop.MediaPlayer2.GetMetadata`" == *'string "mpris:artUrl"'* ]] @@ -37,4 +41,7 @@ while read -r line ; do else pactl set-sink-mute 0 no fi done & $DIR/spotify "$@" & wait $! && test -z "`jobs -p`" || kill `jobs -p` # http://stackoverflow.com/a/2618497 -
pcworld revised this gist
Jul 29, 2012 . 1 changed file with 1 addition and 1 deletion.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -21,7 +21,7 @@ #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY #DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND -
pcworld created this gist
Jul 29, 2012 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,40 @@ #!/bin/bash #Linux Spotify Ad Mute v1 - simply run this script after you've started Spotify. #System sound will be muted as soon as an ad plays #Find updated versions at: http://pcworldsoftware.kilu.net/files/link_spotify-admute.php and/or https://gist.github.com/pcworld # #Copyright (c) 2012, "pcworld", 0188801@gmail.com #All rights reserved. # #Redistribution and use in source and binary forms, with or without #modification, are permitted provided that the following conditions are met: # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the following disclaimer. # * Redistributions in binary form must reproduce the above copyright # notice, this list of conditions and the following disclaimer in the # documentation and/or other materials provided with the distribution. # * Neither the name of the author nor the # names of its contributors may be used to endorse or promote products # derived from this software without specific prior written permission. # #THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND #ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED #WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE #DISCLAIMED. IN NO EVENT SHALL <COPYRIGHT HOLDER> BE LIABLE FOR ANY #DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES #(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; #LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND #ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT #(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS #SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. dbus-monitor "type='signal',path='/org/mpris/MediaPlayer2',member='PropertiesChanged'" | grep --line-buffered 'string "Metadata"' | while read -r line ; do if ! [[ "`dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify / org.freedesktop.MediaPlayer2.GetMetadata`" == *'string "mpris:artUrl"'* ]] then pactl set-sink-mute 0 yes else pactl set-sink-mute 0 no fi done