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.sh
and save it somewhere. I’ve saved mine at~/Applications/cmus-osx
directory. -
Change the permissions to make the script executable:
chmod +x ~/Applications/cmus-osx/update-library.sh
-
Open
CMUS
:cmus
-
Enter the following within
CMUS
to bind the update script to theu
key::bind -f common u shell ~/Applications/cmus-osx/update-library.sh
-
There you go! You can new press the
u
key to update your entire library when withinCMUS
.