#!/bin/sh # wav to flac script # # This script asssumes that the wav files names # matches one the the following: # # 1) tracknumber - artist - album - title.wav # 2) artist - album - titel.wav # 3) artist - title.wav # 4) title.wav # # (these informations will be used to fill the flac tag) # # Autor Thorsten Gunkel # # --- 09.04.2002 Thorsten Gunkel --- # * Split wav2 into wav2mp3, wav2ogg and wav2flac # --- No older changelog available --- # encoder="nice /usr/bin/flac -8 -o \"\$ofilename\" \"\$ifilename\"" suffix="flac" # --- wav2 --- # nr of parameters numb=$# # do while there are parameters while [ $numb -gt 0 ] do ifilename="$1"; shift; numb=`expr $numb - 1` name="`echo "$ifilename" | sed s/".wav"$//`" ofilename="$name"".""$suffix" echo "< $ifilename" # ignore files with wrong suffix if [ "$ifilename" != "$ofilename" -a ! -e "$ofilename" ]; then echo "> $ofilename" # guess tag informations # Reset Memory trcknr="" artist="" album="" title="" # 1) if [ "`echo $name | grep " - ".*" - ".*" - "`" ]; then trcknr="`echo "$name" | awk 'BEGIN {FS=" - "} {print $1}'`" artist="`echo "$name" | awk 'BEGIN {FS=" - "} {print $2}'`" album="`echo "$name" | awk 'BEGIN {FS=" - "} {print $3}'`" title="`echo "$name" | awk 'BEGIN {FS=" - "} {print $4}'`" else # 2) if [ "`echo $name | grep " - ".*" - "`" ]; then artist="`echo "$name" | awk 'BEGIN {FS=" - "} {print $1}'`" album="`echo "$name" | awk 'BEGIN {FS=" - "} {print $2}'`" title="`echo "$name" | awk 'BEGIN {FS=" - "} {print $3}'`" else # 3) if [ "`echo $name | grep " - "`" ]; then artist="`echo "$name" | awk 'BEGIN {FS=" - "} {print $1}'`" title="`echo "$name" | awk 'BEGIN {FS=" - "} {print $2}'`" #4) else title="`echo "$name" | awk 'BEGIN {FS=" - "} {print $1}'`" fi fi fi echo "Filename: $ifilename" echo "Nr.: $trcknr" echo "Artist: $artist" echo "Album: $album" echo "Title: $title" eval "$encoder" errornr=$? echo echo ">--------------" echo else echo echo "XXX Destination file already exists or wrong input file!" echo fi done # --- wav2 ---