[OT] Handy functions for ripping movies
Hi,
While ripping a bunch of (legal!) DVDs, I came up with these bash
functions to make the task simpler. Hope you find it useful someday.
You'll, of course, have to modify the DEST & TARGET values to suit
your own organizational theories. For me, movies and tv shows go in
separate directories
$ get_movie Jungle_Book_\(1942\)
$ get_movie Love_Crazy
$ get_video tv/z__movies 1 Halloweentown
$ get_video movies 1 Captain_Kidd
$ get_video movies 2 King_Solomon\'s_Mines
$ pwd
/data/big/video
$ dir
total 233272
drwxr-xr-x 6 me people 4096 2009-01-25 00:25 ./
drwxr-xr-x 8 root people 4096 2009-01-23 09:39 ../
drwxr-xr-x 8 me people 4096 2008-08-03 15:46 anime/
drwxr-xr-x 12 me people 12288 2009-01-25 00:31 movies/
drwxr-xr-x 10 me people 4096 2009-01-24 16:06 shorts/
drwxr-xr-x 45 me people 4096 2009-01-25 00:30 tv/
######### Begin scripts ############
calc() { perl -e "print ''.($*).\"\\n\""; }
get_video ()
{
TYPE=${1}
TITLE_NUM=${2}
NAME=${3}
DVD=/dev/scd0
DEST=/data/big/video/${TYPE}
TARGET=${DEST}/${NAME}.mpeg
ls ${TARGET} 2> /dev/null > /dev/null
rc=$?
if [ ${rc} -eq 0 ];
then
echo ${TARGET} "exists";
return $rc;
fi
echo ${TARGET}
/usr/bin/time -f "%e" -o /tmp/elapsed.txt \
mplayer -dvd-device $DVD dvd://${TITLE_NUM} \
-dumpstream -dumpfile ${TARGET}
num_secs=$(cat /tmp/elapsed.txt)
file_size=$(stat -c%s ${DEST}/${NAME}.mpeg)
echo ${num_secs} "seconds"
echo ${file_size} "bytes"
MBps=$(calc ${file_size}/${num_secs}/1024/1024)
echo $MBps "MB/sec"
}
get_movie ()
{
eject -T $DVD
sleep 2s
get_video movies 1 ${1}
eject $DVD
}
######### End Scripts ############
--
Ron Johnson, Jr.
Jefferson LA USA
"I am not surprised, for we live long and are celebrated poopers."
Reply to: