diff options
author | Petteri Hintsanen <petterih@iki.fi> | 2021-03-11 20:53:11 +0200 |
---|---|---|
committer | Petteri Hintsanen <petterih@iki.fi> | 2021-04-30 00:39:35 +0300 |
commit | 74429d5abfc8399af4cb058eb8e0bad6c5f9be27 (patch) | |
tree | c87660552f542f5899db611a5b6b52ac749fc7f6 /emms-info.el | |
parent | d56d7053a08beab4c4cf047628f6c417bfccb2f2 (diff) |
Make it possible to force-update Emms cache
Add a prefix argument to emms-cache-sync that will unconditionally
update all tracks in Emms cache.
Diffstat (limited to 'emms-info.el')
-rw-r--r-- | emms-info.el | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/emms-info.el b/emms-info.el index a120236..b7a6537 100644 --- a/emms-info.el +++ b/emms-info.el @@ -75,15 +75,18 @@ Each is called with a track as argument." (defvar emms-info-asynchronous-tracks 0 "Number of tracks we're waiting for to be done.") -(defun emms-info-initialize-track (track) +(defun emms-info-initialize-track (track &optional force) "Initialize TRACK with emms-info information. +Update TRACK information if it is new or has been modified since +last update, or if FORCE is non-nil. + This is a suitable value for `emms-track-initialize-functions'." (if (not emms-info-asynchronously) - (emms-info-really-initialize-track track) + (emms-info-really-initialize-track track force) (setq emms-info-asynchronous-tracks (1+ emms-info-asynchronous-tracks)) - (emms-later-do 'emms-info-really-initialize-track track))) + (emms-later-do 'emms-info-really-initialize-track track force))) -(defun emms-info-really-initialize-track (track) +(defun emms-info-really-initialize-track (track &optional force) "Really initialize TRACK. Return t when the track got changed." (let ((file-mtime (when emms-info-auto-update @@ -93,7 +96,8 @@ Return t when the track got changed." ;; if the file's been modified or is new (when (or (not file-mtime) (not info-mtime) - (emms-time-less-p info-mtime file-mtime)) + (emms-time-less-p info-mtime file-mtime) + force) (run-hook-with-args 'emms-info-functions track) ;; not set by info functions (when file-mtime |