aboutsummaryrefslogtreecommitdiff
path: root/.local/bin
diff options
context:
space:
mode:
authorawy <awy@awy.one>2025-10-13 13:22:35 +0300
committerawy <awy@awy.one>2025-10-13 13:22:35 +0300
commit9ea6cf81adb5d6abc59843de1db45913210f9320 (patch)
treef4cde59dbbc1b4b646bf2e205c2834d58088a82f /.local/bin
parent57f4c61d689fc389d75007796d5ac1a13e791e55 (diff)
downloadhyprdots-9ea6cf81adb5d6abc59843de1db45913210f9320.tar.gz
splitartHEADmaster
Diffstat (limited to '.local/bin')
-rwxr-xr-x.local/bin/splitart32
1 files changed, 32 insertions, 0 deletions
diff --git a/.local/bin/splitart b/.local/bin/splitart
new file mode 100755
index 0000000..0beab28
--- /dev/null
+++ b/.local/bin/splitart
@@ -0,0 +1,32 @@
+#!/bin/bash
+
+# Loop through all FLAC files in the current directory
+for file in *.flac; do
+ # Extract the ARTIST tag from the FLAC file using metaflac
+ artist=$(metaflac --show-tag=ARTIST "$file" | cut -d= -f2)
+
+ # Check if the ARTIST tag contains common delimiters for multiple artists
+ if [[ "$artist" == *"&"* ]] || [[ "$artist" == *","* ]] || [[ "$artist" == *"feat."* ]]; then
+ # Replace '&' with ',' to treat both as the same delimiter
+ artist=$(echo "$artist" | sed 's/&/,/g')
+
+ # Split the ARTIST string by ',' into an array of artists
+ IFS=',' read -r -a artists <<< "$artist"
+
+ # Trim leading/trailing spaces from each artist name
+ for i in "${!artists[@]}"; do
+ artists[$i]=$(echo "${artists[$i]}" | xargs) # Trim spaces
+ done
+
+ # Remove the existing ARTIST tag
+ metaflac --remove-tag=ARTIST "$file"
+
+ # Add each artist as a separate ARTIST tag
+ for artist_name in "${artists[@]}"; do
+ echo "Setting ARTIST to '$artist_name' for file '$file'..."
+ metaflac --set-tag=ARTIST="$artist_name" "$file"
+ done
+ else
+ echo "No combined artists found for '$file', skipping..."
+ fi
+done