mkdir -p ~/.local/share/applications
cp /usr/share/applications/spotify.desktop ~/.local/share/applications
sed -i 's/Exec=spotify %U/Exec=spotify-playlist %U/g' ~/.local/share/applications/spotify.desktop
sudo mkdir -p /usr/local/bin
echo '#!/bin/bash
process="$(pidof spotify|tr -d '\n')"
if [[ -z "${process// }" ]]; then
  /usr/bin/spotify --uri=$@
else
  killall -9 spotify
  /usr/bin/spotify --uri=$@
fi' | sudo tee /usr/local/bin/spotify-playlist
sudo chmod +x /usr/local/bin/spotify-playlist