parent
3c9a0223bc
commit
33ed87f75c
@ -0,0 +1,32 @@
|
||||
#!/bin/bash
|
||||
|
||||
# Check for required arguments
|
||||
if [ $# -ne 2 ]; then
|
||||
echo "Usage: $0 \"GENRE Name\" /path/to/directory"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
genre="$1"
|
||||
target_dir="$2"
|
||||
|
||||
# Check if directory exists
|
||||
if [ ! -d "$target_dir" ]; then
|
||||
echo "Error: '$target_dir' is not a valid directory."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Ensure metaflac is installed
|
||||
if ! command -v metaflac &> /dev/null; then
|
||||
echo "Error: 'metaflac' is not installed. Please install it first."
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Recursively find and tag FLAC files
|
||||
find "$target_dir" -type f -iname "*.flac" | while IFS= read -r flac; do
|
||||
echo "Tagging '$flac' with GENRE=$genre"
|
||||
metaflac --remove-tag=GENRE "$flac"
|
||||
metaflac --set-tag="GENRE=$genre" "$flac"
|
||||
done
|
||||
|
||||
echo "Genre tagging complete."
|
||||
|
||||
Loading…
Reference in new issue