From 33ed87f75c7a4670f92cf90657434fcee3c85791 Mon Sep 17 00:00:00 2001 From: Gabe Farrell Date: Sat, 3 May 2025 20:35:52 +0000 Subject: [PATCH] bleh --- set_genre_flacs.sh | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100755 set_genre_flacs.sh diff --git a/set_genre_flacs.sh b/set_genre_flacs.sh new file mode 100755 index 0000000..d75e0dd --- /dev/null +++ b/set_genre_flacs.sh @@ -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." +