I just use metaflac to add replay gain.
This script i use will work IF you have your files organized by
Artist/Album (where each album has its own folder) (not sure how else it
could/should be organized)

This script will walk the directory entered in the FIRST line.  My files
are in ~/Music/FLAC, so starting there will process all FLAC files.

If you want to use this, test on one Album (or Artist) first:


Code:
--------------------
    
  #!/bin/bash
  
  StartDir=$HOME/Music/FLAC     # No trailing slash!
  count=0
  
  function walk_tree {
        local directory="$1"
        local i
        for i in "$directory"/*
        do
                if [ -d "$i" ]; then    # Process directory and then walk-down
                ls "$i/"*.flac | grep -i -q -s ".flac$" # Does directory 
contain FLAC files?
                if [ $? -eq 0 ] ; then
                        echo "Adding replay gain tags to:"
                        for j in "$i/"*.flac
                        do 
                                echo "$j"
                                let count++
                        done    
                        /usr/local/bin/metaflac --preserve-modtime 
--add-replay-gain "$i/"*.flac
                        echo "$i done!" # echo directory that we're in
                        echo $count files processed.
                fi
                walk_tree "$i"          # DO NOT COMMENT OUT THIS LINE!!
                else
                        continue                # replace continue with command 
to process individual file "$i" (i.e. echo "$i")
                fi
        done
  }
  
  # Process FLAC files in starting directory
  cd "$StartDir"
  ls *.flac | grep -i -q -s ".flac$"            # Does directory contain FLAC 
files?
  if [ $? -eq 0 ] ; then
        echo "Adding replay gain tags to:"
        for j in *.flac
        do 
                echo "$j"
                let count++
        done    
        /usr/local/bin/metaflac --preserve-modtime --add-replay-gain *.flac
        echo "$StartDir done!"  # echo directory that we're in
        echo $count files processed.
  fi
  # Now walk down tree in this directory
  walk_tree "$StartDir"
  
--------------------



Tony
  SBTouch ♪ SBRadio ♬
------------------------------------------------------------------------
Tony T's Profile: http://forums.slimdevices.com/member.php?userid=34544
View this thread: http://forums.slimdevices.com/showthread.php?t=108950

_______________________________________________
ripping mailing list
ripping@lists.slimdevices.com
http://lists.slimdevices.com/mailman/listinfo/ripping

Reply via email to