summaryrefslogtreecommitdiffstats
path: root/.bin/cmus-find-unused-dir
blob: 189bb12698f79abfc5f5a0dd32e146af232fb818 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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.