summaryrefslogtreecommitdiffstats
path: root/.bin/cmus-find-unused-dir
diff options
context:
space:
mode:
authorRomain Gonçalves <me@rgoncalves.se>2024-05-14 18:53:03 +0200
committerRomain Gonçalves <me@rgoncalves.se>2024-05-14 18:53:03 +0200
commit612dbb6993c8a548744f29a4d15d6b31325357c8 (patch)
tree0d61cee0ea74ac811268d0ffc00d3d55f7174112 /.bin/cmus-find-unused-dir
parent23e2bfd987c430bb41bc7860c46c2f572e9e2db4 (diff)
downloaddots-trunk.tar.gz
Tue May 14 06:53:03 PM CEST 2024HEADtrunk
Diffstat (limited to '.bin/cmus-find-unused-dir')
-rwxr-xr-x.bin/cmus-find-unused-dir24
1 files changed, 24 insertions, 0 deletions
diff --git a/.bin/cmus-find-unused-dir b/.bin/cmus-find-unused-dir
new file mode 100755
index 0000000..189bb12
--- /dev/null
+++ b/.bin/cmus-find-unused-dir
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -xe
+
+cmus_path="${HOME}/.config/cmus"
+music_path="${HOME}/music"
+cmus_playlist_files="$(mktemp)"
+
+cat "${cmus_path}/playlists/"* \
+ | xargs -d "\n" -I {} dirname {} \
+ | xargs -I {} basename {} \
+ | sort \
+ | uniq \
+ > "${cmus_playlist_files}"
+
+cmus-find-unused \
+ | xargs -d "\n" -I {} dirname {} \
+ | grep -v -e "^${music_path}$" -e "\." \
+ | xargs -I {} basename {} \
+ | sort \
+ | uniq \
+ | comm -23 - "${cmus_playlist_files}"
+
+rm "${cmus_playlist_files}"
remember that computers suck.