[Music] Introduce ‘db/music’ and move code there
All music related functions that do not directly depend on EMMS will now go into ‘db/music’, with the intention that if we in the future replace EMMS with something else, the API provided by ‘db/music’ will still be valid. This does not mean, however, that functions in ‘db/music’ may not use functions from EMMS.
This commit is contained in:
parent
4128bcd249
commit
888e703448
14
init.el
14
init.el
|
@ -2054,8 +2054,7 @@ search commands like `db/helm-shortcuts’."
|
||||||
:config (require 'emms))
|
:config (require 'emms))
|
||||||
|
|
||||||
(use-package db-emms
|
(use-package db-emms
|
||||||
:commands (db/play-playlist
|
:commands (db/emms-source-file-directory-tree-find
|
||||||
db/emms-source-file-directory-tree-find
|
|
||||||
db/emms-track-description
|
db/emms-track-description
|
||||||
db/emms-playlist-mode-insert-track
|
db/emms-playlist-mode-insert-track
|
||||||
emms-control/body))
|
emms-control/body))
|
||||||
|
@ -2070,6 +2069,17 @@ search commands like `db/helm-shortcuts’."
|
||||||
(require 'emms)
|
(require 'emms)
|
||||||
(require 'helm-adaptive)))
|
(require 'helm-adaptive)))
|
||||||
|
|
||||||
|
(use-package db-music
|
||||||
|
:commands (db/play-playlist))
|
||||||
|
|
||||||
|
(defcustom db/playlist nil
|
||||||
|
"List of songs to include in random playlist."
|
||||||
|
:group 'personal-settings
|
||||||
|
:type '(alist :value-type (choice (const :tag "Undecided" :undecided)
|
||||||
|
(const :tag "Include" :include)
|
||||||
|
(const :tag "Exclude" :exclude))
|
||||||
|
:key-type file))
|
||||||
|
|
||||||
|
|
||||||
;; * Shells and such
|
;; * Shells and such
|
||||||
|
|
||||||
|
|
|
@ -31,30 +31,6 @@
|
||||||
(declare-function string-remove-prefix "subr-x")
|
(declare-function string-remove-prefix "subr-x")
|
||||||
(declare-function emms-with-inhibit-read-only-t "emms")
|
(declare-function emms-with-inhibit-read-only-t "emms")
|
||||||
|
|
||||||
|
|
||||||
;; Custom playlist
|
|
||||||
|
|
||||||
(defun db/play-playlist ()
|
|
||||||
"Play `db/personal-playlist’ in dedicated EMMS buffer."
|
|
||||||
(interactive)
|
|
||||||
(require 'emms)
|
|
||||||
(save-window-excursion
|
|
||||||
(let ((music-buffer-name "*EMMS Playlist* -- Misc"))
|
|
||||||
(unless (get-buffer music-buffer-name)
|
|
||||||
(emms-playlist-new music-buffer-name))
|
|
||||||
(with-current-buffer (get-buffer music-buffer-name)
|
|
||||||
(emms-stop)
|
|
||||||
(emms-playlist-set-playlist-buffer)
|
|
||||||
(emms-playlist-current-clear)
|
|
||||||
(emms-playlist-current-insert-source
|
|
||||||
'emms-insert-directory-tree
|
|
||||||
(expand-file-name "songs/" emms-source-file-default-directory))
|
|
||||||
(goto-char (point-min))
|
|
||||||
(emms-shuffle)
|
|
||||||
;; (emms-playlist-sort-by-play-count)
|
|
||||||
(emms-playlist-select-first)
|
|
||||||
(emms-start)))))
|
|
||||||
|
|
||||||
|
|
||||||
;; Custom file finder
|
;; Custom file finder
|
||||||
|
|
||||||
|
|
35
site-lisp/db-music.el
Normal file
35
site-lisp/db-music.el
Normal file
|
@ -0,0 +1,35 @@
|
||||||
|
;;; db-music.el -- Music related stuff -*- lexical-binding: t -*-
|
||||||
|
|
||||||
|
;;; Commentary:
|
||||||
|
|
||||||
|
;;; Code:
|
||||||
|
|
||||||
|
|
||||||
|
;; Custom playlist
|
||||||
|
|
||||||
|
(defun db/play-playlist ()
|
||||||
|
"Start playing songs from `db/playlist’"
|
||||||
|
(interactive)
|
||||||
|
(require 'emms)
|
||||||
|
(save-window-excursion
|
||||||
|
(let ((music-buffer-name "*EMMS Playlist* -- Personal"))
|
||||||
|
(unless (get-buffer music-buffer-name)
|
||||||
|
(emms-playlist-new music-buffer-name))
|
||||||
|
(with-current-buffer (get-buffer music-buffer-name)
|
||||||
|
(emms-stop)
|
||||||
|
(emms-playlist-set-playlist-buffer)
|
||||||
|
(emms-playlist-current-clear)
|
||||||
|
(dolist (track db/playlist)
|
||||||
|
(when (eq :include (cdr track))
|
||||||
|
(emms-playlist-current-insert-source 'emms-insert-file (car track))))
|
||||||
|
(goto-char (point-min))
|
||||||
|
(emms-shuffle)
|
||||||
|
(emms-playlist-select-first)
|
||||||
|
(emms-start)))))
|
||||||
|
|
||||||
|
|
||||||
|
;; End
|
||||||
|
|
||||||
|
(provide 'db-music)
|
||||||
|
|
||||||
|
;;; db-music ends here
|
Loading…
Reference in New Issue
Block a user