(require 'mingus)
(require 'emms-setup)
(emms-devel)
(add-to-list 'emms-info-functions 'emms-info-mpd)
(add-to-list 'emms-player-list 'emms-player-mpd)
(emms-player-mpd-connect)
(setq emms-source-file-default-directory "~/music")
(setq
emms-pbi-popup-default-width 60
emms-player-mpg321-parameters '("-q" "--aggressive" "-o" "alsa")
emms-player-ogg123-parameters '("-q" "-b" "1024" "-d" "oss"))
(define-emms-simple-player modmplayer '(file) (regexp-opt '(".it" ".xm" ".mod" ".ft")) "mplayer")
(defun emms-google-for-lyrics ()
(interactive)
(browse-url
(concat "http://www.google.com/search?q="
(replace-regexp-in-string " +" "+"
(concat "lyrics "
(delete ?- (emms-playlist-current)))))))
(defvar multimedia-keymap (make-sparse-keymap "Multimedia")
"Keymap used to globally access multimedia functions")
(define-key mode-specific-map [?m] multimedia-keymap)
(define-key multimedia-keymap [?m] 'mingus)
(define-key multimedia-keymap [?n] 'emms-next)
(define-key multimedia-keymap [?p] 'emms-previous)
(define-key multimedia-keymap [?w] 'emms-show)
(define-key multimedia-keymap [?s] 'emms-stop)
(define-key multimedia-keymap [?b] 'emms-sort)
(define-key multimedia-keymap [?B] 'emms-shuffle)
(define-key multimedia-keymap [?e] 'emms-tageditor-edit-current)
(define-key multimedia-keymap [?A] 'emms-play-all)
(define-key multimedia-keymap [?f] 'emms-play-file)
(define-key multimedia-keymap [?F] 'emms-play-find)
(define-key multimedia-keymap [?d] 'emms-play-directory-tree)
(define-key multimedia-keymap [?l] 'emms-playlist-mode-go)
(define-key dired-mode-map [?(] 'emms-play-dired)
(define-key dired-mode-map [?)] 'emms-add-dired)
(defun oa:emms-playlist-mpd ()
(interactive)
(emms-player-mpd-connect)
(emms-playlist-mode-go))
(defun oa:emms-player-mpd-mute ()
(interactive)
(emms-player-mpd-send "setvol 0" nil #'ignore))
(define-key multimedia-keymap [?+] 'emms-player-mpd-volume-up)
(define-key multimedia-keymap [?-] 'emms-player-mpd-volume-down)
(define-key multimedia-keymap [?v] 'amixer-set-volume)
(global-set-key [XF86AudioLowerVolume] 'emms-player-mpd-volume-down)
(global-set-key [XF86AudioRaiseVolume] 'emms-player-mpd-volume-up)
(global-set-key [XF86AudioMute] 'oa:emms-player-mpd-mute)
(global-set-key [XF86AudioPlay] 'oa:emms-playlist-mpd)
(global-set-key [(shift XF86Reload)] 'emms-play-directory-tree)
(global-set-key [XF86Reload] 'oa:emms-playlist-mpd)
(global-set-key [XF86Back] 'emms-previous)
(global-set-key [XF86Forward] 'emms-next)
(global-set-key [XF86Stop] #'(lambda ()
(interactive)
(if emms-player-playing-p
(emms-stop)
(emms-start))))
(global-set-key [(shift XF86AudioLowerVolume)] 'emms-previous)
(global-set-key [(shift XF86AudioRaiseVolume)] 'emms-next)
(global-set-key [(shift XF86AudioPause)] #'(lambda ()
(interactive)
(if emms-player-playing-p
(emms-stop)
(emms-start))))
(global-set-key [XF86Calculator] 'emms-play-directory-tree)