I often find myself updating my music library, which can cause CMUS to go out sync. So I began looking for a solution to help me update the CMUS cache on the fly! I found a post on Github by c0llision that guided me to the script below!
All it does is bind a few commands to the u key in CMUS. So every time you need to update your CMUS library, just press the u key on your keyboard!
Create the following file:
#!/bin/bash cmus-remote -C clear cmus-remote -C "add ~/Music" cmus-remote -C "update-cache -f"Name it
update-library.shand save it somewhere. I’ve saved mine at~/Applications/cmus-osxdirectory.Change the permissions to make the script executable:
chmod +x ~/Applications/cmus-osx/update-library.shOpen
CMUS:cmusEnter the following within
CMUSto bind the update script to theukey::bind -f common u shell ~/Applications/cmus-osx/update-library.shThere you go! You can new press the
ukey to update your entire library when withinCMUS.