shell/mpd/bin/cleanup-music: fail on error + refactor
This commit is contained in:
parent
daec400b02
commit
86fe87369b
|
@ -3,7 +3,9 @@
|
|||
# Delete all songs that are in the delete-pls playlist, and cleans up any empty folders
|
||||
# it leaves behind.
|
||||
|
||||
playlistfile=$HOME/music/.playlists/delete-pls.m3u
|
||||
set -e
|
||||
|
||||
playlistfile=$HOME/music/.db/playlists/delete-pls.m3u
|
||||
songs=$(<"$playlistfile")
|
||||
|
||||
# Delete designated songs
|
||||
|
@ -18,6 +20,5 @@ for song in ${songs[@]}; do
|
|||
done
|
||||
:>"$playlistfile"
|
||||
|
||||
# Remove empty directories in two passes
|
||||
find "$HOME/music" -maxdepth 2 -type d -empty -delete
|
||||
find "$HOME/music" -maxdepth 1 -type d -empty -delete
|
||||
# Remove empty directories
|
||||
find "$HOME/music" -type d -empty -delete
|
||||
|
|
Loading…
Reference in a new issue