diff options
author | 2012-12-05 00:44:09 +0100 | |
---|---|---|
committer | 2012-12-05 00:44:09 +0100 | |
commit | 6278e2e634b05027d31220afd328a9f7fe77c6f1 (patch) | |
tree | 3dbec6a3880ca980694def0d737a477b68254691 /.emacs.d/site-lisp/metalexpress.el | |
parent | fa717d86a07d009ab324a40cd8dbf539e61a9da3 (diff) | |
parent | 15adc911da3f5b527c74b6bb67d677898d6a173e (diff) | |
download | dotfiles-6278e2e634b05027d31220afd328a9f7fe77c6f1.tar.gz dotfiles-6278e2e634b05027d31220afd328a9f7fe77c6f1.zip |
Merge remote-tracking branch 'origin/master' into phoenix
Conflicts:
.emacs.d/site-lisp/oni.el
Diffstat (limited to '.emacs.d/site-lisp/metalexpress.el')
-rw-r--r-- | .emacs.d/site-lisp/metalexpress.el | 38 |
1 files changed, 34 insertions, 4 deletions
diff --git a/.emacs.d/site-lisp/metalexpress.el b/.emacs.d/site-lisp/metalexpress.el index 9d57c19..2f77638 100644 --- a/.emacs.d/site-lisp/metalexpress.el +++ b/.emacs.d/site-lisp/metalexpress.el @@ -30,20 +30,50 @@ (defcustom metal-express-radio-playlist-url "http://usa7-vn.mixstream.net/listen/8248.m3u" - "The URL of the Metal Express Radio stream.") + "The URL of the Metal Express Radio stream." + :group 'metal-express-radio + :type 'string) + +(defcustom metal-express-radio-song-changed-hook nil + "Hook run when the currently playing song changes." + :type 'hook + :group 'metal-express-radio) + +(defvar metal-express-radio-currently-playing nil + "The currently playing song.") + +(defun mer-proc-filter (proc string) + (when (string-match "^ICY Info: StreamTitle='\\(.*\\)';StreamUrl='';" + string) + (setq metal-express-radio-currently-playing (match-string 1 string)) + (apply 'run-hooks metal-express-radio-song-changed-hook))) + +(defun metal-express-radio-echo-currently-playing () + (interactive) + (message metal-express-radio-currently-playing)) + +(defun metal-express-radio-notify () + (interactive) + (notifications-notify :title "Now playing:" + :body metal-express-radio-currently-playing)) ;;;###autoload (defun metal-express-radio-start () "Start listening to Metal Express Radio." (interactive) - (async-shell-command - (concat "mplayer " metal-express-radio-playlist-url) - "*Metal Express Radio*")) + (let ((proc (start-process "metalexpress" "*Metal Express Radio*" + "mplayer" metal-express-radio-playlist-url))) + (set-process-filter proc #'mer-proc-filter))) (defun metal-express-radio-stop () "Stop listening to Metal Express Radio." (interactive) (kill-process (get-buffer-process "*Metal Express Radio*"))) +(add-hook 'metal-express-radio-song-changed-hook + 'metal-express-radio-echo-currently-playing) +(add-hook 'metal-express-radio-song-changed-hook + 'metal-express-radio-notify) + (provide 'metalexpress) ;;; metalexpress.el ends here |