dotfiles

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

album1.sh (857B)


      1 #!/bin/bash
      2 
      3 # Script for changing specific album names.
      4 
      5 # Path to the specific album directory
      6 album_dir=""
      7 
      8 # The desired album name for these files
      9 album_name=""
     10 
     11 # Loop through all FLAC files in the directory
     12 find "$album_dir" -type f -name "*.flac" | while read -r file; do
     13     # Extract the current ALBUM metadata
     14     raw_album=$(metaflac --show-tag=ALBUM "$file")
     15 
     16     # Check if the ALBUM tag exists
     17     if [[ "$raw_album" == ALBUM=* ]]; then
     18         echo "Updating existing ALBUM metadata for: $file"
     19     else
     20         echo "No ALBUM metadata found for: $file. Adding ALBUM tag."
     21     fi
     22 
     23     # Remove the existing ALBUM tag (if it exists)
     24     metaflac --remove-tag=ALBUM "$file"
     25 
     26     # Set the new ALBUM tag with the desired name
     27     metaflac --set-tag=ALBUM="$album_name" "$file"
     28 
     29     echo "Updated ALBUM metadata for: $file -> $album_name"
     30 done
     31