Created
May 21, 2011 13:56
-
-
Save tototoshi/984542 to your computer and use it in GitHub Desktop.
emms便利だねってことでanything使ってごにょごにょする。すでにanything-emmsてのあるっぽいけど。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defvar anything-emms-directory-candidates-cache nil) | |
(defvar anything-emms-file-candidates-cache nil) | |
(defun anything-my-emms-clear-cache () | |
(interactive) | |
(setq anything-emms-directory-candidates-cache nil | |
anything-emms-file-candidates-cache nil)) | |
(defun anything-get-emms-directory-candidates () | |
(cond ((null anything-emms-directory-candidates-cache) | |
(setq anything-emms-directory-candidates-cache | |
(split-string | |
(shell-command-to-string | |
(format "find %s -type d" emms-source-file-default-directory)) | |
"\n"))) | |
(t anything-emms-directory-candidates-cache))) | |
(defun anything-get-emms-file-candidates () | |
(cond ((null anything-emms-file-candidates-cache) | |
(setq anything-emms-file-candidates-cache | |
(split-string | |
(shell-command-to-string | |
(format "find %s -type f" emms-source-file-default-directory)) | |
"\n"))) | |
(t anything-emms-file-candidates-cache))) | |
(defvar anything-c-source-emms-directories | |
'((name . "Music Directories") | |
(candidates . anything-get-emms-directory-candidates) | |
(action | |
. (("Open" . (lambda (candidate) | |
(emms-play-directory candidate))))))) | |
(defvar anything-c-source-emms-files | |
'((name . "Music files") | |
(candidates . anything-get-emms-file-candidates) | |
(action | |
. (("Open" . (lambda (candidate) | |
(emms-play-file candidate))))))) | |
(defun anything-my-emms () | |
(interactive) | |
(anything '(anything-c-source-emms-directories anything-c-source-emms-files))) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment