diff options
Diffstat (limited to 'lisp/+emms.el')
-rw-r--r-- | lisp/+emms.el | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/lisp/+emms.el b/lisp/+emms.el new file mode 100644 index 0000000..a43daea --- /dev/null +++ b/lisp/+emms.el | |||
@@ -0,0 +1,38 @@ | |||
1 | ;;; +emms.el -*- lexical-binding: t; -*- | ||
2 | |||
3 | (defun +emms-streams (&optional file) | ||
4 | "Better interface for `emms-streams'. | ||
5 | If FILE is non-nil, use it. Otherwise use `emms-streams-file'. | ||
6 | If `emms-streams-file' is nil or this function is called with | ||
7 | \\[universal-argument], prompt the user." | ||
8 | (interactive | ||
9 | (list (cond | ||
10 | ((or emms-streams-file | ||
11 | (not current-prefix-arg)) | ||
12 | emms-streams-file) | ||
13 | (:else (read-file-name "Stream file: " | ||
14 | emms-source-file-default-directory))))) | ||
15 | (when (and (not (file-exists-p emms-streams-file)) | ||
16 | (y-or-n-p "Emms' bulit-in streams file hasn't been installed yet. Install it now?")) | ||
17 | (emms-streams-install)) | ||
18 | (let ((buf (get-buffer emms-streams-buffer-name))) | ||
19 | (when (not buf) | ||
20 | (with-current-buffer (get-buffer-create emms-streams-buffer-name) | ||
21 | (setq buf (current-buffer)) | ||
22 | (emms-playlist-mode) | ||
23 | (setq emms-playlist-buffer-p t) | ||
24 | (emms-playlist-set-playlist-buffer (current-buffer)) | ||
25 | (with-current-buffer (find-file-noselect emms-streams-file) | ||
26 | (cond | ||
27 | ((emms-source-playlist-native-p) | ||
28 | (emms-add-native-playlist emms-streams-file)) | ||
29 | ((emms-source-playlist-m3u-p) | ||
30 | (emms-add-m3u-playlist emms-streams-file)) | ||
31 | ((emms-source-playlist-pls-p) | ||
32 | (emms-add-pls-playlist emms-streams-file)) | ||
33 | (:else (error "Streams file `%s' isn't in a known format." | ||
34 | emms-streams-file)))))) | ||
35 | (switch-to-buffer buf))) | ||
36 | |||
37 | (provide '+emms) | ||
38 | ;;; +emms.el ends here | ||