Distributed mode working properly with lame

This commit is contained in:
louwrentius 2011-09-01 00:30:45 +00:00
parent 55f4b1f2e2
commit edb7c21683
2 changed files with 63 additions and 0 deletions

11
ppss-wav2mp3.cfg Normal file
View File

@ -0,0 +1,11 @@
REMOTE_OUTPUT_DIR=/storage/mp3
SSH_KEY=ppss-key.dsa
SSH_KNOWN_HOSTS=known_hosts
SRC_DIR=/storage/wav
COMMAND='./wav2mp3.sh "$ITEM" /storage/mp3'
NODES_FILE=nodes.txt
SSH_SERVER=10.0.1.110
USER=ppss
SCRIPT=wav2mp3.sh
PPSS_LOCAL_TMPDIR=ppss_dir/PPSS_LOCAL_TMPDIR
PPSS_LOCAL_OUTPUT=ppss_dir/PPSS_LOCAL_OUTPUT

52
wav2mp3.sh Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env bash
INPUT="$1"
DEST="$2"
LAMEOPTS=""
function usage () {
echo
echo "Usage: $0 <wav file name>"
echo
exit 1
}
if [ -z "$INPUT" ]
then
usage
fi
if [ ! -e "$INPUT" ]
then
echo "File $INPUT does not exist!"
exit 1
fi
TYPE=`file -b "$INPUT"`
RES=`echo "$TYPE" | grep "WAVE audio"`
if [ ! "$?" == "0" ]
then
echo "File $FILE is not a wav file..."
echo "Type is $TYPE"
exit 0
fi
function convert () {
FILE="$1"
MP3FILE="`echo ${FILE%wav}mp3`"
RAWDIR=`dirname "$MP3FILE"`
DIR="$DEST/$RAWDIR"
BASENAME=`basename "$MP3FILE"`
mkdir -p "$DIR"
lame --quiet --preset insane "$FILE" "$DIR/$BASENAME"
return $?
}
convert "$INPUT"
exit "$?"