diff options
author | Damien Elmes <emms@repose.cx> | 2006-06-11 09:54:00 +0000 |
---|---|---|
committer | Damien Elmes <emms@repose.cx> | 2006-06-11 09:54:00 +0000 |
commit | 0d8660d516e90069b6442b9a68072a2346d15d63 (patch) | |
tree | 83c2180f35d9b98a5aa8f1d56636197fae3a3d1c | |
parent | 0b2e933c5c46532b2e94cf4542571d2bdfd16862 (diff) |
emms-cache: add pruning support, make save/load interactive
darcs-hash:20060611095400-4e3e3-5624cdc454d14b7f4ffb03cc84f8883bf2fe291e.gz
-rw-r--r-- | emms-cache.el | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/emms-cache.el b/emms-cache.el index 868aefd..f95ccd4 100644 --- a/emms-cache.el +++ b/emms-cache.el @@ -108,6 +108,7 @@ This is used to cache over emacs sessions.") (defun emms-cache-save () "Save the track cache to a file." + (interactive) (when emms-cache-dirty (message "Saving emms track cache...") (set-buffer (get-buffer-create " emms-cache ")) @@ -124,8 +125,22 @@ This is used to cache over emacs sessions.") (defun emms-cache-restore () "Restore the track cache from a file." + (interactive) (load emms-cache-file t nil t) (setq emms-cache-dirty nil)) +(defun emms-cache-prune () + "Remove invalid entries from the cache." + ;; FIXME: at the moment, only supports files + (interactive) + (message "Pruning emms track cache...") + (maphash (lambda (path track) + (when (eq (emms-track-get track 'type) 'file) + (unless (file-exists-p path) + (remhash path emms-cache-db)))) + emms-cache-db) + (setq emms-cache-dirty t) + (message "Pruning emms track cache...done")) + (provide 'emms-cache) ;;; emms-cache.el ends here |