#!/bin/bash # # ripping v0.1 October 2000 # # This is my first shell script ever... # for any comments/complaints/suggestions # email nitrosso@supernet.com.ar # # petit script (mon premier!) # pour enregistrer une liste de chansons # a partir d un cd sur son disque dur en # format ogg-vorbis (MP3 ne reposant pas # sur des algorithmes du domaine public...) # # type : ./ripping -h to have an overview of this script # # VISIT WWW.XIPH.ORG FOR INFORMATION ON OGG-VORBIS FORMAT AND PROJECT # ######### REMPLIR CES PARAMETRES######################################## # bibzique=/usr/share/OggMusic chanteur="Chico Buarque" album="As Cidades" fichier=/home/bruno/chico.db # ######### REMPLIR CES PARAMETRES######################################## # # #------------------- #1. this fuction scans the DB file and prints what the script would do #------------------- function imprime_test { echo -e "The following songs by $chanteur will be ripped in ogg format \n" while read track title ; do echo -e "\t track number $track song \"$title\"" done echo -e "\nThey all come from album \"$album\" \n" \ "The files will be stored at $bibzique\n" \ "\n \t \t DOES THIS MAKE SENSE TO YOU?" } < $fichier # # #------------------- # 2. this function prints help info #------------------- function imprime_aide { echo -e "This scripts calls CDPARANOIA and OGGENC.\n" \ "both come from Open Source effort by www.xiph.org\n\n"\ "You should use/support this instead of patented MP3 format" echo "as usual, it turns out that ogg-vorbis format is also better..." echo "" echo 'This script reads the file $fichier which should look like this:' echo "" echo -e "\t\ttrack_number_n song title in many words\n" \ "\t\ttrack_number_p another song title\n" echo -e "For instance:\n" echo "6 Comme un avion sans ailes" echo "10 Fauteuil en cuir" echo "" echo "" echo "si vous avez pris l option -t il ne fera que vous imprimer" echo "les chansons qu il lirait/coderait/enregistrerait" } #--- # Main program #--- # usage="Usage : $0 [-t (for test)] [-h (for help)]" # cd /tmp # # test to see if cdparanoia is installed ... if ! cdparanoia -V 2> /dev/null then echo 'Either cdparanoia is not installed or not in a $PATH directory' exit 1 fi # declare -i track=0 # while getopts ":th" opt; do case $opt in t ) imprime_test exit 0 ;; h ) imprime_aide exit 0 ;; \? ) echo $usage exit 1 ;; esac done # shift $(($OPTIND - 1)) # { while read track title ; do # if cdparanoia $track && \ oggenc -l "$album" -a "$chanteur" -t "$title" cdda.wav then echo "Track number $track was succesfully ripped" rm cdda.wav mv "$title".ogg $bibzique/. else echo "Track number $track has generated a problem" fi done } < $fichier #