diff options
author | Michael Olson <mwolson@gnu.org> | 2006-07-30 22:31:00 +0000 |
---|---|---|
committer | Michael Olson <mwolson@gnu.org> | 2006-07-30 22:31:00 +0000 |
commit | f7d41460d9077b0c553d63f17c702c659e3d53ee (patch) | |
tree | f878e98a27fc6362df83a379759e1ae71484dd87 /emms-player-mpd.el | |
parent | aa9c184f2e41d831bed2c209112f4299ce27f58a (diff) |
emms-player-mpd: Add support for updating MusicPD's database and improve documentation.
darcs-hash:20060730223147-1bfb2-5e323fa65ecb32976db21c07a96143d36d65d7e8.gz
Diffstat (limited to 'emms-player-mpd.el')
-rw-r--r-- | emms-player-mpd.el | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/emms-player-mpd.el b/emms-player-mpd.el index 143f9bf..bf36757 100644 --- a/emms-player-mpd.el +++ b/emms-player-mpd.el @@ -1107,7 +1107,10 @@ The track should be an alist as per `emms-player-mpd-get-alist'." "Dump all MusicPD data from DIR into the EMMS cache. This is useful to do when you have recently acquired new music." (interactive - (list (read-string "Directory: "))) + (list (if emms-player-mpd-music-directory + (read-directory-name "Directory: " + emms-player-mpd-music-directory) + (read-string "Directory: ")))) (unless (string= dir "") (setq dir (emms-player-mpd-get-mpd-filename dir))) (if emms-cache-set-function @@ -1132,6 +1135,33 @@ order to prime the cache." (interactive) (emms-cache-set-from-mpd-directory "")) +;;; Updating tracks + +(defun emms-player-mpd-update-directory (dir) + "Cause the tracks in DIR to be updated in the MusicPD database." + (interactive + (list (if emms-player-mpd-music-directory + (read-directory-name "Directory: " + emms-player-mpd-music-directory) + (read-string "Directory: ")))) + (unless (string= dir "") + (setq dir (emms-player-mpd-get-mpd-filename dir))) + (emms-player-mpd-send + (concat "update " dir) nil + (lambda (closure response) + (let ((id (cdr (assoc "updating_db" + (emms-player-mpd-get-alist + (emms-player-mpd-parse-response response)))))) + (if id + (message "Updating DB with ID %s" id) + (message "Could not update the DB")))))) + +(defun emms-player-mpd-update-all () + "Cause all tracks in the MusicPD music directory to be updated in +the MusicPD database." + (interactive) + (emms-player-mpd-update-directory "")) + (provide 'emms-player-mpd) ;;; emms-player-mpd.el ends here |