LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 12-15-2008, 01:44 AM   #1
True`Colors
LQ Newbie
 
Registered: Mar 2007
Location: Urziceni - Romania
Distribution: Fedora 16
Posts: 12

Rep: Reputation: 0
Audio CD ripping & ogg encoding


Any advice would be appreciated...

=================================
#!/bin/bash

for file in `seq 1 99 $CDNUM`

do

ofile=${file}

cdparanoia ${file} - | oggenc --resample 22050 -o "${ofile}.ogg" -

done
=================================
 
Old 12-25-2008, 01:06 AM   #2
HerbertJ
LQ Newbie
 
Registered: Oct 2008
Posts: 28

Rep: Reputation: 16
What is the purpose of the $CDNUM variable? "seq" is only going to return 1 if $CDNUM is set.


NAME
seq - print a sequence of numbers

SYNOPSIS
seq [OPTION]... LAST
seq [OPTION]... FIRST LAST
seq [OPTION]... FIRST INCREMENT LAST


Examples:

# seq 1 99 5
1
# seq 1 99 3
1
# seq 1 99 6
1
# seq 1 99 99
1
# seq 1 99 100
1
100
# seq 1 99 104
1
100
# seq 1 99 200
1
100
199

Perhaps something like:

------------
if [[ "$CDNUM" != "" ]] ; then TRACKS=$CDNUM; else TRACKS=`seq 1 99`; fi
for file in $TRACKS
------------

Proof:

herbert@logical:~$ CDNUM=5 ; if [[ "$CDNUM" != "" ]] ; then TRACKS=$CDNUM; else TRACKS=`seq 1 99`; fi ;echo $TRACKS
5
herbert@logical:~$ unset CDNUM ; if [[ "$CDNUM" != "" ]] ; then TRACKS=$CDNUM; else TRACKS=`seq 1 99`; fi ;echo $TRACKS
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
 
Old 11-19-2010, 04:12 PM   #3
True`Colors
LQ Newbie
 
Registered: Mar 2007
Location: Urziceni - Romania
Distribution: Fedora 16
Posts: 12

Original Poster
Rep: Reputation: 0
Fix CD audio ripping & ogg encoding

#!/bin/bash
clear

echo " "

echo --------------------------
echo Removing contents of Trash...
echo --------------------------

rm -rfv ./.local/share/Trash/files/*
rm -rfv ./.local/share/Trash/info/*

echo " "

if [ ! -d ${HOME}/ogg ]
then

# Only make dir ogv if it doesn't exist
echo --------------------------
echo ${HOME}/ogg did not exist creating...
echo --------------------------

mkdir "${HOME}/ogg"
fi

cd ${HOME}

for file in `seq 1 99`

do

ofile=${file}

cdparanoia ${file} - | oggenc -o "$HOME/ogg/${ofile}.ogg" -

done
 
Old 11-19-2010, 06:57 PM   #4
devnull10
Member
 
Registered: Jan 2010
Location: Lancashire
Distribution: Slackware Stable
Posts: 572

Rep: Reputation: 120Reputation: 120
This is the shell script I wrote to rip audio cd's to MP3. Maybe you can adapt it or use parts to help you.

Code:
if [ $# -ne 1 ]
then
  echo "Usage: " `basename $0` "<output directory>"
  exit
fi

if [ ! -d $1 ] 
then
  echo "$1 is not a valid directory"
  exit
fi

# Need determine the number of tracks on the disc
n_files=`cdparanoia -Q 2>&1 | egrep "^ *[0-9]+\." | wc -l`

if [ $n_files -lt 1 ]
then
  echo "ERROR - Can't find any tracks - is the CD inserted?"
  exit
fi

echo -e "Ripping $n_files files..."

for i in `seq 1 $n_files`
do
  cdparanoia -q $i - | lame --silent -h --vbr-new -V 4 - `printf "%s/track_%02d.mp3" $1 $i`
  echo  - Sucessfully ripped track $i
done

echo "Ripping complete"
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
LXer: Ripping and Encoding Audio Files in Linux LXer Syndicated Linux News 0 10-25-2007 11:20 PM
Ogg & Theora: one-way encoding problems deadlinx Linux - Software 6 03-27-2007 11:25 AM
Ripping to ogg in Grip dannyboy2k Linux - Desktop 5 01-18-2007 09:34 AM
Linux Distro Live CD for Video & Audio Encoding UltimateLinux Linux - Distributions 1 08-26-2005 12:22 PM
Considerable jitter/drift preventing DAE/ripping of audio CDs. (XMMS & cdparanoia) mithrascruor Linux - Software 1 11-14-2004 02:42 PM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:09 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration