You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
739 B
33 lines
739 B
#!/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."
|
|
|