Last active
November 16, 2024 23:56
-
-
Save veebch/e925cbd977ee205c0e495c98a2791352 to your computer and use it in GitHub Desktop.
A single command to invoke a fzf interface that generates playlists from a subset of music added to a directory in the last 10 days
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Find directories in music folder modified in last 240 hours | |
fd . '/path/to/music/' \ | |
--changed-within "240h" \ | |
--min-depth 2 \ | |
-d 2 \ | |
| \ | |
# Remove any paths containing @ symbol (Synology NAS quirk) | |
rg -v '@' \ | |
| \ | |
sed "s|/path/to/music/||" \ | |
| \ | |
# Interactive fuzzy selection with multi-select enabled | |
fzf --multi \ | |
| \ | |
# For each selected directory, find MP3/FLAC files | |
xargs -I{} fd . "/path/to/music/{}" \ | |
-type f \ | |
\( -iname "*.mp3" -o -iname "*.flac" \) \ | |
-print0 \ | |
| \ | |
# Sort the null-terminated file list | |
sort -z \ | |
| \ | |
# Convert null bytes to proper newlines using sed | |
sed 's/\x0/\n/g' > /path/to/playlists/newmusic.m3u |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This relies on a music directory that is structured {Artist}/{Album}/{Tracks}. Tested with mpd and ncmpcpp
Here it is running: https://www.threads.net/@v_e_e_b/post/DCO1A4vxj6j?xmt