From a3a19b09ccbb3b9909d3ce50a21b8fe3ca2636b8 Mon Sep 17 00:00:00 2001 From: Damien Elmes Date: Thu, 22 Jun 2006 11:45:00 +0000 Subject: cache: add a routine to refresh metadata info darcs-hash:20060622114528-4e3e3-edaed29b327826bdbac2e172177dfa9e37214c15.gz --- emms-cache.el | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/emms-cache.el b/emms-cache.el index f95ccd4..df9bd7f 100644 --- a/emms-cache.el +++ b/emms-cache.el @@ -142,5 +142,26 @@ This is used to cache over emacs sessions.") (setq emms-cache-dirty t) (message "Pruning emms track cache...done")) +(defun emms-cache-refresh () + "Update entries in the cache where the file is newer." + (interactive) + (message "Updating emms track cache...") + (maphash (lambda (path track) + (when (eq (emms-track-get track 'type) 'file) + (let ((file-mtime (emms-info-track-file-mtime track)) + (info-mtime (emms-track-get track 'info-mtime))) + (when (or (not info-mtime) + (emms-time-less-p + info-mtime file-mtime)) + (run-hook-with-args 'emms-info-functions track))))) + emms-cache-db) + (message "Updating emms track cache...done")) + +(defun emms-cache-sync () + "Remove old entries and update modified files." + (interactive) + (emms-cache-prune) + (emms-cache-refresh)) + (provide 'emms-cache) ;;; emms-cache.el ends here -- cgit v1.2.3