[Abcde-users] How to get the CD folder for the post_encode function

andrew andrew.david.strong at gmail.com
Thu Jun 18 22:53:31 BST 2015


Hi again Bernd:

On Thu, Jun 18, 2015 at 09:39:39PM +0200, Bernd Fischer-Krellenberg (gmail) wrote:

> tried to write a post encode function to convert flac to alac.  The
> point is I can't get the the actual CD folder.  I can get the
> general output directory with $OUTPUTDIR, but there seems to be no
> variable for the CD folder.  Tried to use $ALBUMFILE, but this
> doesn’t work.
> 
> Any one an idea how to solve this?

The good news is that now abcde 2.7 has been released my next plan
involves looking at encoding to alac but I admit that this will
probably use wine and qaac rather than either avconv or FFmpeg.

But certainly in the short term I have just tested the following
post_encode function and it works well enough with FFmpeg and
doubtless will also work with avconv:

#-------------------------------------------------#
#                                                 #
# A post_encode function to convert flac files to #
# alac using FFmpeg (it will probably work with   #
# avconv as well...).                     Andrew  #
#                                                 #
#-------------------------------------------------#
post_encode ()
{
ARTISTFILE="$(mungefilename "$TRACKARTIST")"
ALBUMFILE="$(mungefilename "$DALBUM")"

if [ "$VARIOUSARTISTS" = "y" ] ; then
FINDPATH="$(eval echo "$VAOUTPUTFORMAT")"
else
FINDPATH="$(eval echo "$OUTPUTFORMAT")"
fi

FINALDIR="$(dirname "$OUTPUTDIR/$FINDPATH")"
cd "$FINALDIR"

for j in *.flac
do 
ffmpeg -i "$j" -c:a alac "${j%.flac}.m4a"
done

mkdir backup
mv *.flac backup
}

A modern FFmpeg neatly copies across the meta data as well which is a
nice bonus.

All the best,

Andrew

-- 
You think that's air you're breathing now?



More information about the Abcde-users mailing list