aboutsummaryrefslogtreecommitdiff
path: root/emms-cache.el
diff options
context:
space:
mode:
authorDamien Elmes <emms@repose.cx>2006-06-22 11:45:00 +0000
committerDamien Elmes <emms@repose.cx>2006-06-22 11:45:00 +0000
commita3a19b09ccbb3b9909d3ce50a21b8fe3ca2636b8 (patch)
tree4cbd48968e73bf35d437394f5d216a0dcbd6a1d4 /emms-cache.el
parent6115f3d510a1d052921210268575ec54a358523c (diff)
cache: add a routine to refresh metadata info
darcs-hash:20060622114528-4e3e3-edaed29b327826bdbac2e172177dfa9e37214c15.gz
Diffstat (limited to 'emms-cache.el')
-rw-r--r--emms-cache.el21
1 files changed, 21 insertions, 0 deletions
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