aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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