Codice: Seleziona tutto
#!/bin/sh
#script pacprip
cdinfo=`pacpl --device=/dev/sr0 --cdinfo`
#
#computing info about album
#
album=`echo "$cdinfo" | head -n 4 | tail -n 1`
lengthalbum=`echo $album | wc -c | tr -d ' '`
album=`echo "$album" | cut -c10-"$lengthalbum"`
#
#computing information about artist
#
artist=`echo "$cdinfo" | head -n 3 | tail -n 1`
lengthartist=`echo $artist | wc -c | tr -d ' '`
artist=`echo "$artist" | cut -c10-"$lengthartist"`
#
#computing information about year
#
year=`echo "$cdinfo" | head -n 7 | tail -n 1`
lengthyear=`echo $year | wc -c | tr -d ' '`
lengthyear=`echo $lenghtyear | bc`
year=`echo "$year" | cut -c10-"$lengthyear"`
#
#checking the number of traks
#
track=`echo "$cdinfo" | head -n 6 | tail -n 1`
lengthtrack=`echo $track | wc -c | tr -d ' '`
lengthyear=`echo $lenghttrack | bc`
track=`echo "$track" | cut -c10-"$lengthtrack"`
echo "Will be ripped the $album ($year) album by $artist. There are $track tracks\n"
#make a directory named after the artist and one named after the album
#with the year before the title, so if you have the discography
#it will be ordered from the older to the newer
#In order to do this first we have to make the artist
#and the album title in a way such that they could be accepted by mkdir
#
OUTDIR=~/Musica/"$artist"/"$year - $album"
if [ ! -d "$OUTDIR" ]; then
echo "Output dir will be created."
mkdir -p "$OUTDIR"
fi
if [ $track -gt 10 ]; then
pacpl -v --rip 1,2,3,4,5,6,7,8,9 --to mp3 --bitrate 320 --nscheme "0%tr - %ti" --device=/dev/sr0 --outdir "$OUTDIR";
counter=10
while [ $counter -le $track ];do
pacpl -v --device=/dev/cdrom1 --rip $counter --to mp3 --bitrate 320 --nscheme "%tr - %ti" --device=/dev/sr0 --outdir "$OUTDIR";
counter=`echo $counter+1 | bc`
done
else
pacpl -v --device=/dev/cdrom1 --rip all --to mp3 --bitrate 320 --nscheme "0%tr - %ti" --device=/dev/sr0 --outdir "$OUTDIR";
fi

