aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--emms-source-file.el29
-rw-r--r--emms-source-playlist.el54
2 files changed, 77 insertions, 6 deletions
diff --git a/emms-source-file.el b/emms-source-file.el
index 2062f97..c234d04 100644
--- a/emms-source-file.el
+++ b/emms-source-file.el
@@ -67,6 +67,17 @@ find, but it's faster."
emms-source-file-directory-tree-find)
:group 'emms-source-file)
+(defcustom emms-source-file-exclude-regexp
+ (concat "\\`\\(.*\\.?#.*\\|.*,v\\|.*~\\|\\.\\.?\\|,.*\\)\\'\\|"
+ "/\\(CVS\\|RCS\\|\\.arch-ids\\|{arch}\\|,.*\\|\\.svn\\|"
+ "_darcs\\)\\(/\\|\\'\\)")
+ "A regexp matching files to be ignored when adding directories.
+
+You should set case-fold-search to nil before using this regexp
+in code."
+ :type 'regexp
+ :group 'emms-source-file)
+
(defcustom emms-source-file-gnu-find "find"
"*The program name for GNU find."
:type 'string
@@ -105,8 +116,10 @@ from the user."
emms-source-file-default-directory
t)))
(mapc (lambda (file)
- (emms-playlist-insert-track
- (emms-track 'file (expand-file-name file))))
+ (unless (let ((case-fold-search nil))
+ (string-match emms-source-file-exclude-regexp file))
+ (emms-playlist-insert-track
+ (emms-track 'file (expand-file-name file)))))
(directory-files dir t (emms-source-file-regex))))
;;;###autoload (autoload 'emms-play-directory-tree "emms-source-file" nil t)
@@ -120,8 +133,10 @@ value of `emms-source-file-default-directory'."
emms-source-file-default-directory
t)))
(mapc (lambda (file)
- (emms-playlist-insert-track
- (emms-track 'file file)))
+ (unless (let ((case-fold-search nil))
+ (string-match emms-source-file-exclude-regexp file))
+ (emms-playlist-insert-track
+ (emms-track 'file file))))
(emms-source-file-directory-tree (expand-file-name dir)
(emms-source-file-regex))))
@@ -137,8 +152,10 @@ value of `emms-source-file-default-directory'."
t)
(read-from-minibuffer "Find files matching: ")))
(mapc (lambda (file)
- (emms-playlist-insert-track
- (emms-track 'file file)))
+ (unless (let ((case-fold-search nil))
+ (string-match emms-source-file-exclude-regexp file))
+ (emms-playlist-insert-track
+ (emms-track 'file file))))
(emms-source-file-directory-tree dir regex)))
;;;###autoload (autoload 'emms-play-dired "emms-source-file" nil t)
diff --git a/emms-source-playlist.el b/emms-source-playlist.el
index 5d5bd8d..943be54 100644
--- a/emms-source-playlist.el
+++ b/emms-source-playlist.el
@@ -411,6 +411,60 @@ This moves point."
(error
nil))))
+;;; Adding playlists as files
+
+;;;###autoload (autoload 'emms-play-playlist-file "emms-source-playlist" nil t)
+;;;###autoload (autoload 'emms-add-playlist-file "emms-source-playlist" nil t)
+(define-emms-source playlist-file (file)
+ "An EMMS source for playlist files.
+This adds the given file to the current EMMS playlist buffer,
+without adding its contents.
+
+See `emms-source-playlist-formats' for a list of supported formats."
+ (interactive (list (read-file-name "Playlist file: "
+ emms-source-file-default-directory
+ emms-source-file-default-directory
+ t)))
+ (emms-playlist-insert-track
+ (emms-track 'playlist (expand-file-name file))))
+
+;;;###autoload (autoload 'emms-play-playlist-directory
+;;;###autoload "emms-source-playlist" nil t)
+;;;###autoload (autoload 'emms-add-playlist-directory
+;;;###autoload "emms-source-playlist" nil t)
+(define-emms-source playlist-directory (dir)
+ "An EMMS source for a whole directory tree of playlist files.
+If DIR is not specified, it is queried from the user."
+ (interactive (list
+ (emms-read-directory-name "Play directory: "
+ emms-source-file-default-directory
+ emms-source-file-default-directory
+ t)))
+ (mapc (lambda (file)
+ (unless (let ((case-fold-search nil))
+ (string-match emms-source-file-exclude-regexp file))
+ (emms-playlist-insert-track
+ (emms-track 'playlist (expand-file-name file)))))
+ (directory-files dir t "^[^.]")))
+
+;;;###autoload (autoload 'emms-play-playlist-directory-tree
+;;;###autoload "emms-source-playlist" nil t)
+;;;###autoload (autoload 'emms-add-playlist-directory-tree
+;;;###autoload "emms-source-file" nil t)
+(define-emms-source playlist-directory-tree (dir)
+ "An EMMS source for multiple directory trees of playlist files.
+If DIR is not specified, it is queried from the user."
+ (interactive (list
+ (emms-read-directory-name "Play directory tree: "
+ emms-source-file-default-directory
+ emms-source-file-default-directory
+ t)))
+ (mapc (lambda (file)
+ (unless (let ((case-fold-search nil))
+ (string-match emms-source-file-exclude-regexp file))
+ (emms-playlist-insert-track
+ (emms-track 'playlist file))))
+ (emms-source-file-directory-tree (expand-file-name dir) "^[^.]")))
(provide 'emms-source-playlist)
;;; emms-source-playlist.el ends here