All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jeremy Abbott <jkbullfrog@comcast.net>
To: linux-newbie@vger.kernel.org
Subject: My first bash script.
Date: Sat, 01 Jan 2005 22:55:00 +0000	[thread overview]
Message-ID: <41D72A44.6090301@comcast.net> (raw)

I wrote my first bash script the other day to automatically rip my CDs 
to 128k mp3s.  I was wondering if anyone had any idea or suggestions for 
the script to improve or streamline it.  Thanks in advance. Here it is:

#!/bin/bash
#
# The purpose of this script is to automatically rip CD's to wav format,
# ask for artist name, and track titles and then encoding them into mp3's
# with the following naming conventions:
#
# Track# - Artist - Track title.mp3
# eg. 01 - Metallica - Blackened.mp3 or 02 - Metallica - ...And Justice 
For All.mp3


# make a temp directory, and copy tracks off of /dev/cdrom into temp 
folder using
# cdparanoia

STARTING_DIR=`pwd`

if [ -d $HOME/TEMPRIPPER ]; then
    cd $HOME/TEMPRIPPER
else
    mkdir $HOME/TEMPRIPPER &
    cd $HOME/TEMPRIPPER
fi

cdparanoia -B

# Ask user for artist name, then titles for provided track number, then 
encodes
# the correct track number into an mp3 using the naming conventions 
found in
# the header.

TRACKNUM=01
clear

echo -n "Who is the artist? "
read ARTIST

while [ -a track${TRACKNUM}.cdda.wav ]
do
    if [ -a $HOME/TEMPRIPPER/track${TRACKNUM}.cdda.wav ]; then
        echo -n "What is the title of track $TRACKNUM? "
        read TITLE       
        lame -h $HOME/TEMPRIPPER/track${TRACKNUM}.cdda.wav 
$STARTING_DIR/"$TRACKNUM - $ARTIST - $TITLE.mp3"
        TRACKNUM=`expr $TRACKNUM + 1`
        if test $TRACKNUM -lt "10"; then
            case $TRACKNUM in
                2) TRACKNUM=02;;
                3) TRACKNUM=03;;
                4) TRACKNUM=04;;
                5) TRACKNUM=05;;
                6) TRACKNUM=06;;
                7) TRACKNUM=07;;
                8) TRACKNUM=08;;
                9) TRACKNUM=09;;
            esac
        fi
    fi
done

cd $STARTING_DIR
rm -rf $HOME/TEMPRIPPER

exit 0

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

             reply	other threads:[~2005-01-01 22:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-01-01 22:55 Jeremy Abbott [this message]
2005-01-01 22:58 ` My first bash script Jeremy Abbott

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=41D72A44.6090301@comcast.net \
    --to=jkbullfrog@comcast.net \
    --cc=linux-newbie@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.