[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Script for using neroAacEnc and neroAacTag with rubyripper



I knocked out a shell script for ripping audio CDs with rubyripper, spent entirely too much time on it (forgot that eval takes care of f%^$ shell quotes) and finally ended up using foobar2k in a windows VM (because foobar's tagger is less hassle for me to work with than rubyripper (especially for stuff like disc #, etc), but I'd hate to waste this.

It assumes that neroAacEnc and neroAacTag are in the path (because I keep my copies in /usr/local/bin).

--Joseph Lenox
------------

#!/bin/bash
# Shell script to interface with neroAacEnc and neroAacTag for tagging of AAC files. # Basically put all neroAacTag options and neroAacEnc options on the command line, script
# sorts out the two based on the presence of the -meta prefix for the tab.
# Written by Joseph Lenox, lordofhyphens@gmail.com
# PUBLIC DOMAIN - I provide no warranty, use as you will.
TAG=()
ENC=""
input=""
output=""
curr_arg=""
echo $@ > /tmp/output
for i in "$@"; do
    echo "$i" | grep -q -e "^-."
    if [ `echo $?` -eq 0 ]; then
        if [ `echo $curr_arg | grep -c -e "^-meta"` -gt 0 ]; then
            #append this to the tag list
# curr_arg="`echo $curr_arg | sed -e 's|artist=|artist=|g' -e 's| |_|g'`"
            echo $curr_arg
TAG=( ${TAG[@]} `echo "$curr_arg" | sed -e 's|=|="|' -e 's|$|"|'` )
            curr_arg="`echo $i | sed -e 's|=|=|' `"
        else
            if [ `echo $curr_arg | grep -c -e "^-of"` -gt 0 ]; then
                output=`echo $curr_arg | sed 's|-of\ ||'`
                curr_arg=""
            fi
            if [ `echo $curr_arg | grep -c -e "^-if"` -gt 0 ]; then
                input=`echo $curr_arg | sed 's|-if\ ||'`
                curr_arg=""
            fi
            if [ `echo $curr_arg | grep -c -e "^-w"` -gt 0 ]; then
                curr_arg=""
            fi
            ENC="$ENC `echo $curr_arg`"
            curr_arg="$i"
        fi
    else
        curr_arg="$curr_arg `echo $i`"
    fi
done

#echo ${TAG[@]}
#echo $ENC
#echo "$output"
neroAacEnc $ENC -if "$input" -of "$output"
#echo neroAacTag "$output" ${TAG[@]}
eval neroAacTag \"$output\" ${TAG[@]}


Reply to: