Created
November 28, 2024 19:01
-
-
Save br4instormer/ad8a66e91ea6ed5d30d423758ced4ce2 to your computer and use it in GitHub Desktop.
Collect all bandcamp links from flac files on nested directories
This file contains hidden or 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
#!/usr/bin/env bash | |
SAVEIFS=$IFS | |
IFS=$(echo -en "\n\b") | |
LINKS=() | |
for dir in */ | |
do | |
file=$(find "./$dir" -name "*.flac" -print -quit) | |
if [ "$file" ] | |
then | |
comment=$(metaflac --show-tag=COMMENT "$file") | |
if echo "$comment" | grep -q "COMMENT=Visit "; then LINKS+=("${comment#"COMMENT=Visit "}"); fi | |
fi | |
done | |
sorted_links=$(printf '%s\n' "${LINKS[@]}" | sort -u) | |
echo "${sorted_links[*]}" | |
IFS=$SAVEIFS |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment