summaryrefslogblamecommitdiffstats
path: root/.bin/cmus-find-unused-dir
blob: 189bb12698f79abfc5f5a0dd32e146af232fb818 (plain) (tree)























                                                
#!/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.