diff --git a/README.org b/README.org index 61fd3a9..1fc5b81 100644 --- a/README.org +++ b/README.org @@ -103,13 +103,12 @@ All of the options are defined early in the config, this is for two reasons: The #+begin_src emacs-lisp ;; All of the modules available sorted in their default load order. (defconst dotfiles/modules-p - '(trash keys org evil dired magit - shell mu4e elfeed eshell vterm - gpg pass x11 exwm roam agenda - spelling grammar reveal hugo - capture projects docker lsp dap - cc go uml conf python fonts ivy - themes modeline dashboard)) + '(trash keys org evil dired magit shell + emms mu4e elfeed eshell vterm gpg pass + x11 exwm roam agenda spelling grammar + reveal hugo capture projects docker + lsp dap cc go uml conf python fonts + ivy themes modeline dashboard)) ;; All of the enabled modules. (defvar dotfiles/modules dotfiles/modules-p) diff --git a/config/mpd.conf b/config/mpd.conf new file mode 100644 index 0000000..e7141e0 --- /dev/null +++ b/config/mpd.conf @@ -0,0 +1,6 @@ +music_directory "~/.local/share/media/music" + +playlist_directory "~/.local/share/media/playlists" + +bind_to_address "localhost" +port "6600" diff --git a/early-init.el b/early-init.el index f801c9d..2a34f26 100644 --- a/early-init.el +++ b/early-init.el @@ -53,13 +53,12 @@ ;; All of the modules available sorted in their default load order. (defconst dotfiles/modules-p - '(trash keys org evil dired magit - shell mu4e elfeed eshell vterm - gpg pass x11 exwm roam agenda - spelling grammar reveal hugo - capture projects docker lsp dap - cc go uml conf python fonts ivy - themes modeline dashboard)) + '(trash keys org evil dired magit shell + emms mu4e elfeed eshell vterm gpg pass + x11 exwm roam agenda spelling grammar + reveal hugo capture projects docker + lsp dap cc go uml conf python fonts + ivy themes modeline dashboard)) ;; All of the enabled modules. (defvar dotfiles/modules dotfiles/modules-p) diff --git a/modules/emms.org b/modules/emms.org new file mode 100644 index 0000000..35b53ba --- /dev/null +++ b/modules/emms.org @@ -0,0 +1,86 @@ +#+TITLE: EMMS +#+AUTHOR: Christopher James Hayward +#+EMAIL: chris@chrishayward.xyz + +#+PROPERTY: header-args:emacs-lisp :tangle emms.el :comments org +#+PROPERTY: header-args :results silent :eval no-export :comments org + +#+OPTIONS: num:nil toc:nil todo:nil tasks:nil tags:nil +#+OPTIONS: skip:nil author:nil email:nil creator:nil timestamp: nil + +EMMS[fn:1] is Emacs as a multimedia player. + +* Setup + +Make sure you install the required packages on your system before loading the module. + +#+begin_src shell +RUN apt install -y mpc mpd mpv +#+end_src + +** Music player daemon +:PROPERTIES: +:header-args: :tangle ../config/mpd.conf +:END: + +MPD[fn:2] uses a simple text configuration file. Most options only accept a string in " quotes ". The most important option to configure is the ~music_directory~. This is where all of the music ~mpd~[fn:2] will serve exists. It will read the directory recursively. + +#+begin_src conf +music_directory "~/.local/share/media/music" +#+end_src + +You can configure where ~mpd~[fn:2] will look for playlists. You may want to configure this option if you share your playlists between devices. + +#+begin_src conf +playlist_directory "~/.local/share/media/playlists" +#+end_src + +It's possible to serve ~mpd~[fn:2] over the network by configuring it to listen on =0.0.0.0=, or by the systems host name. For a local setup, leave it as =localhost=. + +#+begin_src conf +bind_to_address "localhost" +port "6600" +#+end_src + +*** Deploy the configuration + +MPD[fn:2] will look for its configuration in =~/.config/mpd/mpd.conf=, and =/etc/mpd.conf= respectively. + +#+begin_src emacs-lisp +(let ((mpd-dir "~/.config/mpd")) + (unless (file-exists-p mpd-dir) + (make-directory mpd-dir t)) + (dotfiles/symlink "~/.emacs.d/config/mpd.conf" + (concat mpd-dir "/mpd.conf"))) +#+end_src + +* Config + +Displays and play multimedia from within Emacs with ~emms~[fn:1], using a variety of external players from different sources. It can run as a minimalist player and controlled with commands, or a fully fledged interactive media browser. It can display album art, play streaming media, tag files, search lyrics, and provide ~mpd~[fn:2] connectivity. + +#+begin_src emacs-lisp +(use-package emms + :custom (emms-player-mpd-server-name "localhost") + (emms-player-mpd-server-port "6600") + :config (require 'emms-setup) + (require 'emms-player-mpd) + (emms-all) + (emms-default-players) + (add-to-list 'emms-info-functions 'emms-info-mpd) + (add-to-list 'emms-player-list 'emms-player-mpd)) +#+end_src + +* Shortcuts + +Place bindings for ~emms~[fn:1] behind =SPC u=: + +#+begin_src emacs-lisp +(dotfiles/leader + "u" '(:ignore t :which-key "EMMS")) +#+end_src + +* Footnotes + +[fn:1] https://gnu.org/software/emms/ + +[fn:2] https://musicpd.org