#!/bin/bash echo "MOSHE BAR ParaRip --> MP3/OGG <-- version 0.08282k3-e" echo " " function ERROR { echo " COMMAND: pararip [-b|-o|-c|-mp3|-ogg|-clean|-help][bitrate] " echo " EXAMPLE: pararip -b -128 " echo " rips tracks from a CDROM and converts them into 128 bps mp3 files." echo "SYNTAX and INSTRUCTIONS" echo "First argument: [-b|-o|-c|-mp3|-ogg|-clean|-help]" echo "This specifies:" echo "-b rip and encode in MP3 -mp3 Encode existing WAV files into MP3." echo "-o rip and encode in OGG -ogg Encode existing WAV files into OGG." echo "-c rip only to .WAV files. -clean Delete(Clean out) existing WAV files." echo "-help Summon this help screen." echo " " echo "Second argument: Must be a number between 64 and 256" echo "This specifies the bit-rate of the output mp3 or ogg file. While" echo "both encoders support values less than 64 (and may support those higher" echo "than 256, this program will not permit values outside these ranges as " echo "the resulting files will either be of unsatisfactory quality or too " echo "large given the sound quality; e.g. a 160 bps recording doesn't sound" echo "any different than a 256 bps recording to the human ear, but it is" echo "almost 50% smaller than the 256 bps recording."k echo " " echo "If omitted, the bitrate will default to 160 bps." echo "That's about it, folks!" echo " " echo "See additional commentary in the code for more info if desired." echo "BASED ON WORK by MOSHE BAR and the OPENMOSIX crew...." echo "--------------> Exiting with code $1 <---------------" exit $1 } function CLUSTER_BLADEENCODE { for n in `ls *.wav`; do echo "Spawning BLADE ENCODE JOB $n to CLUSTER." cpujob bladeenc -quit -quiet $n -br $BITRATE -copy -crc & done } function CLUSTER_OGGENCODE { for in in `ls *.wav`; do echo "Spawning OGGENCODE JOB $n to CLUSTER." cpujob oggenc -$n -b $BITRATE done } function START_OPENMOSIX { # Let's make sure openMosix is running and start it if it isn't, shall we? /etc/init.d/openmosix status | grep disabled if [ $? -eq 0 ]; then echo "Starting openmosix." /etc/init.d/openmosix start fi } #This checks the command-line for the first argument. if [ -z $1 ]; then echo "You need to supply at least one command-line argument:" echo "You must specify -o to encode with oggenc or -b to encode with" echo "bladeenc." ERROR 1 fi #This checks the command-line for the second argument. Lacking same, #PARARIP will assume a default rate of 160 kbps (which is probably about the optimum #quality that the human ear can detect. if [ -z $2 ]; then echo "setting default for the BITRATE" BITRATE=160 else ######## Do you _really_ want an MP3 at leass than 96 kbps? Ugh!!!! if [ $2 -lt 64 ] ; then echo "That will produce an output file of unacceptably poor quality." echo " " ERROR 2 elif [ $2 -gt 256 ]; then echo "That is a waste of space. The human ear cannot reliably detect" echo "improvements above about 160 bps." echo " " ERROR 3 else ###### Let's set the bitrate, then. BITRATE=$2 fi #bugcheck. echo "Bitrate is --->$BITRATE<---" fi START_OPENMOSIX case "$1" in -c|-C|-cd|-wav|-WAV|-w|-W|-CD) echo "Ripping only. You need to encode with -ogg or -mp3 later. " cdparanoia -B exit 0 ;; -B|-b) cdparanoia -B echo "Ripping and then Encoding with Bladeenc. " CLUSTER_BLADEENCODE ;; -o|-O) echo "Ripping and then Encloding with Oggenc. " cdparanoia -B CLUSTER_OGGENCODE ;; -mp3|-MP3) echo "BLADEENC only: Making MP3s from existing files. " CLUSTER_BLADEENCODE ;; -ogg|-OGG) echo "OGGENC only: Making ogg files from existing WAV files. " ENCODE="cpujob oggenc -$n -b $BITRATE " CLUSTER_OGGENCODE ;; -clean) echo "Removing wave files from current directory. " rm -Rf *.wav ;; -help) ERROR 0 ;; *) echo "You have not chosen a valid option." ERROR 3 ;; esac