-
Notifications
You must be signed in to change notification settings - Fork 3
/
misc-emms.el
97 lines (82 loc) · 3.66 KB
/
misc-emms.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
(require 'emms-setup)
(require 'emms-info-libtag)
(require 'emms-player-mpg321-remote)
(require 'emms-mode-line-icon)
(emms-devel)
(emms-default-players)
(push 'emms-player-mpg321-remote emms-player-list)
(push 'emms-player-mplayer emms-player-list)
(push 'emms-player-mplayer-playlist emms-player-list)
(setq
emms-info-asynchronously t
later-do-interval 0.0001
emms-source-file-default-directory "/media/Entertainment/Music/Chinese/周杰伦/"
emms-show-format "NP: %s")
(global-set-key (kbd "<kp-subtract>") 'emms-previous)
(global-set-key (kbd "<kp-add>") 'emms-next)
(global-set-key (kbd "<kp-multiply>") 'emms-random)
(setq emms-mode-line-icon-before-format "["
emms-mode-line-format " %s]"
emms-mode-line-icon-color "blue")
(defun emms-mode-line-icon-function ()
(concat " "
emms-mode-line-icon-before-format
(propertize "NP:" 'display emms-mode-line-icon-image-cache)
(format emms-mode-line-format (emms-track-get
(emms-playlist-current-selected-track)
'info-title))))
(setq emms-mode-line-titlebar-function 'emms-mode-line-playlist-current)
(setq emms-info-functions '(emms-info-libtag))
;; Stolen and adapted from TWB
(defun my-emms-info-track-description (track)
"Return a description of the current track."
(if (and (emms-track-get track 'info-artist)
(emms-track-get track 'info-title))
(let ((pmin (emms-track-get track 'info-playing-time-min))
(psec (emms-track-get track 'info-playing-time-sec))
(ptot (emms-track-get track 'info-playing-time))
(art (emms-track-get track 'info-artist))
(tit (emms-track-get track 'info-title)))
(cond ((and pmin psec) (format "%s - %s [%02d:%02d]" art tit pmin psec))
(ptot (format "%s - %s [%02d:%02d]" art tit (/ ptot 60) (% ptot 60)))
(t (emms-track-simple-description track))))
(emms-track-simple-description track)))
(setq emms-track-description-function 'my-emms-info-track-description)
(defun de-add-dir ()
(interactive)
(call-interactively 'emms-add-directory-tree)
(emms-playlist-mode-go))
(defun system-notify (title message)
"invoke notify-send"
(interactive "")
(start-process-shell-command "*Output*" nil
(concat "notify-send \"" title "\" \"" message "\"")))
(add-hook
'Emms-Player-Started-Hook
'(lambda ()(system-notify
"EMMS is now playing..."
(emms-track-description (emms-playlist-current-selected-track)))))
;; global key-map
;; all global keys prefix is C-c e
;; compatible with emms-playlist mode keybindings
;; you can view emms-playlist-mode.el to get details about
;; emms-playlist mode keys map
(global-set-key (kbd "C-c e s") 'emms-stop)
(global-set-key (kbd "C-c e P") 'emms-pause)
(global-set-key (kbd "C-c e n") 'emms-next)
(global-set-key (kbd "C-c e p") 'emms-previous)
(global-set-key (kbd "C-c e f") 'emms-show)
(global-set-key (kbd "C-c e >") 'emms-seek-forward)
(global-set-key (kbd "C-c e <") 'emms-seek-backward)
;; these keys maps were derivations of above keybindings
(global-set-key (kbd "C-c e S") 'emms-start)
(global-set-key (kbd "C-c e g") 'emms-playlist-mode-go)
(global-set-key (kbd "C-c e t") 'emms-play-directory-tree)
(global-set-key (kbd "C-c e h") 'emms-shuffle)
(global-set-key (kbd "C-c e e") 'emms-play-file)
(global-set-key (kbd "C-c e l") 'emms-play-playlist)
(global-set-key (kbd "C-c e r") 'emms-toggle-repeat-track)
(global-set-key (kbd "C-c e R") 'emms-toggle-repeat-playlist)
(global-set-key (kbd "C-c e u") 'emms-score-up-playing)
(global-set-key (kbd "C-c e d") 'emms-score-down-playing)
(global-set-key (kbd "C-c e o") 'emms-score-show-playing)