Skip to content

Instantly share code, notes, and snippets.

@seanbreckenridge
Last active October 17, 2020 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save seanbreckenridge/8ec7da1c81cf3741396b29af5f7253b7 to your computer and use it in GitHub Desktop.
Save seanbreckenridge/8ec7da1c81cf3741396b29af5f7253b7 to your computer and use it in GitHub Desktop.
Lists abums not in any of my playlists https://github.com/seanbreckenridge/plaintext-playlist
#!/bin/bash
# lists any songs in my music folder that aren't in any playlists
# https://github.com/seanbreckenridge/plaintext-playlist
# get list of all songs
ALL_SONGS="$(plainplay listall "$(plainplay playlistdir)"/*)"
# move to my music directory
cd "$PLAINTEXT_PLAYLIST_MUSIC_DIR" || {
echo "Couldn't cd to music directory" 1>&2
exit 1
}
# find prints the leading directory file name, this is a approximation (the cut -d"/" -f2
# most of the time prints the Artistname/AlbumName since thats what my Music directory looks like)
# read that filename into a loop, and check if that album has any songs in the giant list
# of all songs in my playlist
# if no matches are found, print that directory
find -maxdepth 3 -type f -printf '%h\n' | sort -u | cut -d "/" -f2- | while IFS= read -r dir; do
echo "$ALL_SONGS" | fgrep -q "$dir" 2>/dev/null || {
echo "${dir}"
}
done
# directories that are printed are interpreted by me as:
# 'there are no songs from this album in any of my playlists', that either means maybe
# I dont like any of the songs there, and thats fine, or I havent got around to listening
# to it and I should, and add songs into a playlist.
@seanbreckenridge
Copy link
Author

Use this pretty often like

not_in_playlist | shuf -n1, to pick a random album which isn't in any of my playlists yet.

go create a playlist for that artist/genre if one doesnt exist, listen to the album, and add any songs I like to a playlist.

lets me make sure Im not missing any albums in my rotation, when running:

plainplay shuffleall "$(plainplay playlistdir)"/* to shuffle all songs in my playlists

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment