From d5fa86062b31179c268cb914266f0e646a244229 Mon Sep 17 00:00:00 2001 From: jao Date: Mon, 31 May 2021 04:43:10 +0100 Subject: losing weight: elmpd instead of emms not only simpler, but also asynchronous --- attic/misc.org | 133 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 133 insertions(+) (limited to 'attic/misc.org') diff --git a/attic/misc.org b/attic/misc.org index 3a4df37..23336e0 100644 --- a/attic/misc.org +++ b/attic/misc.org @@ -1,5 +1,138 @@ #+title: Miscellaneous config bits that i don't use anymore +* emms +*** configuration + #+BEGIN_SRC emacs-lisp + (use-package emms + :pin gnu + :ensure t + :init + (setq emms-score-file "~/.emacs.d/score" + emms-stream-bookmarks-file "~/.emacs.d/streams" + emms-history-file "~/.emacs.d/cache/emms-history" + emms-cache-file "~/.emacs.d/cache/emms-cache" + emms-show-format "%s") + + (setq emms-source-file-default-directory "~/var/lib/music/" + emms-player-list '(emms-player-mpd) + emms-player-mpd-server-name "localhost" + emms-player-mpd-server-port "6600" + emms-player-mpd-music-directory emms-source-file-default-directory) + + (setq emms-volume-change-function 'emms-volume-mpd-change + emms-volume-change-amount 10 + emms-info-ogginfo-coding-system 'utf-8) + + ;; from http://www.shellarchive.co.uk/index.html#%20Prettify%20emms + (setq emms-browser-info-genre-format "%i· %n" + emms-browser-info-artist-format "%i· %n" + emms-browser-info-album-format "%i◨ %n" + emms-browser-info-title-format "%i♪ %n") + + (setq emms-last-played-format-alist + '(((emms-last-played-seconds-today) . "Today at %H:%M") + (604800 . "%a at %H:%M") + ((emms-last-played-seconds-month) . "%d") + ((emms-last-played-seconds-year) . "%m-%d") + (t . ""))) + + :hook ((emms-player-started . emms-player-mpd-show)) + + :config + (eval-after-load "emms-info" + '(add-to-list 'emms-info-functions 'emms-info-mpd))) + + (emms-all) + (emms-mode-line -1) + (emms-playing-time 1) + (emms-playing-time-disable-display) + + (use-package jao-emms-random-album + :after emms + :commands (jao-emms-random-album-next) + :init (setq jao-emms-random-album-notify-icon jao-notify-audio-icon)) + + (use-package jao-emms-info-track + :after emms + :init (setq jao-emms-show-icon jao-notify-audio-icon) + :config (jao-emms-info-setup 50)) + + (use-package jao-emms-lyrics + :after emms + :init (setq jao-lyrics-info-function 'jao-emms-lyrics-track-data)) + + (defvar jao-emms-random-album-notify--pause-icon + "/usr/share/icons/Tango/scalable/actions/media-playback-pause.svg") + + (defun jao-emms--show-status (s status) + (jao-notify (format "%s%s%s" + (cadr s) + (cdr (assoc (car s) status)) + (caddr s)) + "emms" + (if (string= "pause" (cdr (assoc "state" status))) + jao-emms-random-album-notify--pause-icon + jao-notify-audio-icon))) + + (defun jao-emms--osd-status (s &optional pref suff) + (emms-player-mpd-get-status (list s (or pref "") (or suff "")) + 'jao-emms--show-status)) + + #+END_SRC +*** helper functions + #+begin_src emacs-lisp + (defun jao-emms-volume-delta (d) + (funcall emms-volume-change-function d)) + + (defun jao-emms-show-volume () + (jao-emms--osd-status "volume" "Volume " "%")) + + (defalias 'jao-emms-update-cache 'emms-player-mpd-update-all-reset-cache) + + (defun jao-emms-load-streams () + (interactive) + (emms-play-playlist (expand-file-name "~/var/lib/music/streams.list"))) + + (defun jao-emms-search () + (interactive) + (let ((by (completing-read "Search by: " + '("artist" + "composer" + "performer" + "title" + "album" + "names")))) + (if (string= "names" by) + (emms-browser-search-by-names) + (emms-browser-search (list (intern (concat "info-" by))))))) + + (defun jao-emms-echo () + (interactive) + (emms-show) + (jao-emms-update-echo-string) + (emms-show)) + #+end_src +*** Media global aliases + #+begin_src emacs-lisp + (defalias 'jao-player-connect 'emms-player-mpd-connect) + (defalias 'jao-player-toggle 'emms-pause) + (defalias 'jao-player-next 'emms-next) + (defalias 'jao-player-previous 'emms-previous) + (defalias 'jao-player-stop 'emms-stop) + (defalias 'jao-player-start 'emms-start) + (defalias 'jao-player-seek-forward 'emms-seek-forward) + (defalias 'jao-player-seek-backward 'emms-seek-backward) + (defalias 'jao-player-play 'emms-start) + (defalias 'jao-player-search 'jao-emms-search) + (defalias 'jao-player-vol-delta 'jao-emms-volume-delta) + (defalias 'jao-player-volume 'jao-emms-show-volume) + (defalias 'jao-player-osd 'jao-emms-show-osd) + (defalias 'jao-player-echo 'jao-emms-echo) + (defalias 'jao-player-list 'emms-playlist-mode-go) + (defalias 'jao-player-browse 'emms-browser) + (defalias 'jao-player-random-album 'jao-emms-random-album-next) + #+end_src + * enwc #+BEGIN_SRC emacs-lisp (use-package enwc -- cgit v1.2.3