Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on May 8th, 2012  |  syntax: None  |  size: 1.59 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. ;;Small minor mode to control spotify from emacs
  2.  
  3. (defun spotify-play () "Play Spotify" (interactive)
  4.   (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Play"))
  5.  
  6. (defun spotify-pause () "Pause Spotify" (interactive)
  7.   (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Pause"))
  8.  
  9. (defun spotify-playpause () "Play/Pause Spotify" (interactive)
  10.   (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.PlayPause"))
  11.  
  12. (defun spotify-back () "Starts the song over in Spotify" (interactive)
  13.   (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous"))
  14.  
  15. (defun spotify-next () "Next song in Spotify" (interactive)
  16.   (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Next"))
  17.  
  18. (defun spotify-previous () "Previous song in Spotify" (interactive)
  19.   (progn (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")
  20.          (sit-for 0.1)
  21.          (shell-command "dbus-send --print-reply --dest=org.mpris.MediaPlayer2.spotify /org/mpris/MediaPlayer2 org.mpris.MediaPlayer2.Player.Previous")))
  22.  
  23. (global-set-key (kbd "C-c <C-S-right>") 'spotify-next)
  24. (global-set-key (kbd "C-c <C-S-left>") 'spotify-previous)
  25. (global-set-key (kbd "C-c <C-S-up>") 'spotify-playpause)