The following little function works for me: I run it after new music has arrived.
(defun emms-add-files-to-cache () "Search music library for new tracks and add them to the cache." (interactive) (mapc (lambda (file) (emms-track 'file file)) (seq-filter #'(lambda (path) (not (gethash path emms-cache-db))) (directory-files-recursively "/media/shared/music" "\.mp3$\\|\.wav$\\|\.aif$\\|\.ogg")))) ---Fran On Sat, 23 Nov 2024 at 12:17, Petteri Hintsanen <pette...@iki.fi> wrote: > On 22.11.2024 23.54, Igor Sosa Mayor wrote: > > > I have the following problem: if I add new songs or tag old ones with > > Picard, emms-cache-sync does not update the cache. Even not if I do C-u > > emms-cache-sync. In some cases it is even worse: the updated albums > > disapparead from emms-cache-db. > > Note that (1) emms-cache-sync does not look for new files. If you have > added new songs, you have to add them manually with emms-add-... > funtions to get their information into the cache. > > But emms-cache-sync (2) should update cache information for files that > are already in the cache _and_ have been modified since the last cache > update. It should also (3) remove files that are in the cache but do > not exist on the disk anymore. > > As for your problem cases: > > (1) If you add new songs, you have to add them manually to EMMS. > > (2) If you tag existing songs which you have added to EMMS, their info > should get updated by emms-cache-update. If they do not, then it is a bug. > > (3) If you delete songs (from the disk) that you have added to EMMS, > they will be removed from the cache by emms-cache-update. If they do > not, or some other file is removed, that is a bug. > > > I have to do: emms-cache-reset and then emms-add-directory-tree and then > > anything is working again... Except obviously one important aspect: I > > loose all the data about when I last played song X, song Y, etc. And I > > am very happy using filters with emms-browser-filter-only-recent... > > This works but has the consequences you mention. emms-cache-sync should > be the right thing to do. > > > Am I maybe doing something wrong? > > No, I don't think so. Caching is somewhat complicated and requires > occasional manual work. It could be improved. > > >