On Wed, Oct 15, 2003 at 08:21:38PM -0400, S. Massy wrote: > Anyone knows whether there is any way to decode .ape files in Linux? I believe > there is an xmms plugin lying around somewhere: any other decoder one might > use? i was quite surprised to see that the command-line ape decoder seems to run fine under wine. Mac.exe appears to be selfcontained. I had to copy this from an MS machine as the Ape installer didnt work. i'm using this relatively untested script. Maybe others will find it useful....? -----------------start:ape2flac.sh------------------ #!/bin/sh # # wrapper script for converting multiple ape files to flac. # # author: Tim Orford. date: 031015. license: GPL. # # notes: # -any ape meta tags will be lost! # -filenames with spaces are converted to use underscores instead. # -you need to copy Mac.exe to the current directory. # # todo: # -i dont know how you pass arguments to wine when they contain spaces. # -dont know how wine handles paths. Copy Mac.exe to the current # directory. #config: monkeypath="MAC.exe"; # -z == null if [ -z "$1" ]; then echo "usage: ape2flac.sh <filename(s)>" exit; fi; echo "encoding "$#" files to flac..."; declare -i idx; idx=1; #echo "$idx: filename: $filename"; for filename in "$@"; do echo ""; echo $'\033['"01;33m"$idx: $filename$'\033['"0m"; #remove spaces in filenames: newname=${filename// /_}; if [ $newname != $filename ]; then mv "$filename" $newname; fi; filename=$newname; #decode ape to wav: wine -- $monkeypath "$filename" tmp.wav -d #re-encode to flac: if flac --best --no-delete-input-file -V "tmp.wav"\ -o ${filename%.*}.flac > temp.log 2>&1; then echo "flac OK" > /dev/null; #hack else echo "ERROR: flac failed. Pls see flac.log"; fi # check the log file and look for "Verify OK": # -actually we could just check the last line. IFS=" " for line in `cat temp.log`; do #echo line=$line; if echo "$line" | grep "Verify OK" >/dev/null; then echo " Verified Ok"; fi done cat temp.log >> flac.log; rm temp.log; idx=$idx+1; filename=${!idx}; #remove temp if [ -f "tmp.wav" ]; then rm tmp.wav; fi; done; echo ""; echo "ape sucks! flac rocks! :-)" -----------------end:ape2flac.sh------------------ cheers -- Tim Orford