-
Notifications
You must be signed in to change notification settings - Fork 0
/
hc-music.el
63 lines (46 loc) · 1.85 KB
/
hc-music.el
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
51
52
53
54
55
56
57
58
59
60
61
62
63
;;; hc-music.el --- music -*- lexical-binding: t; -*-
;;; Commentary:
;;; Code:
(eval-when-compile (require 'use-package))
;; https://www.gnu.org/software/emms/manual/
(use-package emms-setup
:custom
(emms-source-file-default-directory (concat (hcUlhcd) "/00-music-root"))
:config
(emms-all)
(emms-default-players)
(emms-browser-add-category "title" 'info-title)
:bind (:map emms-browser-mode-map
("b 7" .'emms-browse-by-title))
)
;; brew install exiftool
(require 'emms-info-exiftool)
(add-to-list 'emms-info-functions 'emms-info-exiftool)
(require 'emms-history)
(emms-history-load)
;; HC: not sure if this is necessary
;; https://osxdaily.com/2018/04/29/play-flac-audio-files-mac-vlc/
;; brew install vlc
;; https://www.emacswiki.org/emacs/EMMS
;; Using EMMS on OSX without installing extra audio players
(define-emms-simple-player afplay '(file)
(regexp-opt '(".mp3" ".m4a" ".aac" ".flac")) "afplay")
(setq emms-player-list `(,emms-player-vlc)) ;; ,emms-player-afplay))
;; read and cache tags of all music files
;; M-x emms-add-directory-tree RET emms-source-file-default-directory
;; (emms-add-directory-tree emms-source-file-default-directory)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
(require 'cl-lib)
(defun hc-mac-volume-get ()
"Return current Mac-OS audio volume."
(string-to-number (shell-command-to-string (concat "hcMacVolumeGet"))))
(defun hc-mac-volume-change (amount)
"Change Mac-OS audio volume by AMOUNT."
(let ((new-vol (+ (hc-mac-volume-get) amount)))
(if (zerop (shell-command (format "hcMacVolumeSet %s" new-vol)))
(message "Volume is %s%%" (hc-mac-volume-get))
(message "non zero exit status: hcMacVolumeSet"))))
(setq emms-volume-change-function 'hc-mac-volume-change)
(setq emms-volume-change-amount 10)
(provide 'hc-music)
;;; hc-music.el ends here