shell/mpd/bin/cleanup-music.sh: remove duplicates in playlists
This commit is contained in:
parent
f57649eea9
commit
a8f5fbff14
|
@ -22,5 +22,14 @@ for song in ${songs[@]}; do
|
||||||
done
|
done
|
||||||
:>"$playlistfile"
|
:>"$playlistfile"
|
||||||
|
|
||||||
|
# Remove duplicates in playlists
|
||||||
|
for playlist in "$playlistdir"/*.m3u; do
|
||||||
|
awk '!seen[$0]++' "$playlist" > "${playlist}.tmp"
|
||||||
|
if [[ -f "${playlist}.tmp" ]]; then
|
||||||
|
rm -f "$playlist"
|
||||||
|
mv "${playlist}.tmp" "$playlist"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
# Remove empty directories
|
# Remove empty directories
|
||||||
find "$HOME/music" -type d -empty -delete
|
find "$HOME/music" -type d -empty -delete
|
||||||
|
|
Loading…
Reference in a new issue