summaryrefslogtreecommitdiff
path: root/.config/emacs/modules/bd--emms.el
blob: db071764125463093a4453648f882bbc1b7f48f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
;;; -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:


(defun emms-quickstart ()
  "Queues a shuffled playlist and starts
playback."
  (interactive)
  (emms-stop)
  (when (bufferp emms-playlist-buffer-name)
    (kill-buffer emms-playlist-buffer-name))
  (emms-play-directory-tree (expand-file-name "~/ik/music/"))
  (emms-shuffle))


(use-package emms
  :bind (("C-z C-s" . 'emms-quickstart)
         ("C-z C-p" . 'emms-play-playlist))
  :hook
  (emms-playlist-selection-changed . (lambda ()
                                       (start-process-shell-command "refreshstatus" nil "refreshstatus")))
  :config
  (emms-all)
  (require 'emms-player-mpd)
  (add-to-list 'emms-info-functions 'emms-info-mpd)
  (add-to-list 'emms-player-list 'emms-player-mpd)
  (keymap-global-set "C-z C-m"  (lambda ()
                                  (interactive)
                                  (if (get-buffer emms-playlist-buffer-name)
                                      (display-buffer emms-playlist-buffer-name)
                                    (message "The Ainur cannot hear you..."))))
  ;; "emms-playlist-mode-bury-buffer" plays poorly with shackle
  (keymap-set emms-playlist-mode-map "q" #'quit-window)
  :custom
  ;; make sure mpd is configured similarly
  (emms-player-mpd-server-name "localhost")
  (emms-player-mpd-server-port "6600")
  ;; set dir and volume keys
  (emms-player-mpd-music-directory (expand-file-name "~/ik/music/"))
  (emms-source-file-default-directory (expand-file-name "~/ik/playlists/"))
  (emms-volume-change-function 'emms-volume-mpd-change)
  ;; misc
  (emms-info-report-each-num-tracks 2000)
  (emms-playlist-buffer-name "*Playlist*")
  (emms-mode-line-disable))


(provide 'bd--emms)
;;; bd-emms ends here