#!/bin/bash
# Filename: qd-dvd
# Version: 061111
# Author: robz
# Quick n' dirty single "movie.mpg" to "dvd.iso" to dvdrw/dvdr disk.
# The "movie.mpg" will need to be a dvd compatible file, eg with ffmpeg the
# "-target" switch will be required with pal-dvd or ntsc-dvd or film-dvd set.
# Script will overwrite rw disks without asking so make sure you have the
# right disk in your drive, in my case that drive is /dev/sr0 yours may be
# different.
# Make the script executable and chuck it in the "nautilus-scripts" directory.
# Usage: Insert a disk, right-click file to burn > Scripts > qd-dvd.
trap "killall -q dvdauthor genisoimage growisofs; rm -rf 'tmp-files'; \
exit" INT TERM EXIT # Clean on exit/error.
author_it ()
{
echo -e "\033[1m\E[37mWorking on - $MOVIE" # Colour the headings.
echo -e "\033[1m\E[36mCreating the DVD file structure\033[0m\E[37m"
nice -n 19 dvdauthor -o tmp-files -t $MOVIE && \
echo -e "\033[1m\E[34mSuccessfully created file structure"
echo -e "\033[1m\E[36m\nFinalize the structure\033[0m\E[37m"
VIDEO_FORMAT=PAL nice -n 19 dvdauthor -o tmp-files -T && \
echo -e "\033[1m\E[34mFile Structure finalized"
}
iso_it ()
{
MOVIE=${MOVIE%.mpg}.iso # Change extension.
echo -e "\033[1m\E[36m\nCreating $MOVIE\033[0m\E[37m\
\nThis may take a while, please wait...."
nice -n 19 genisoimage -quiet -V "DVD" -o "$MOVIE" -dvd-video tmp-files && \
tput cuu1; tput el; \
echo -e "\033[1m\E[34mISO created successfully\n\033[0m\E[37m"
}
burn_it ()
{
if ! udisks --show-info /dev/sr0 | grep "media: *optical_dvd_plus_r"; then
echo -e "\033[1m\E[33mOOPS\033[1m\E[37m"
echo -e "No writeable disk! Burn created .iso later eh. \033[1m\E[34m"
read -p "Hit a key to exit" -n1; exit
else
tput cuu1; tput el; tput cuu1
echo -e "\033[1m\E[36m\nBurning $MOVIE\033[0m\E[37m"
echo "This may take a while, please wait.... "
nice -n 19 growisofs -quiet -dvd-compat -Z /dev/sr0="$MOVIE"\
-use-the-force-luke=notray -use-the-force-luke=tty # My drive sr0, yours?
if [ "$?" = "0" ]; then # Did it burn OK?
echo -e "\033[1m\E[32m$MOVIE burned - job done - Bye! \n\033[1m\E[36m"
rm "$MOVIE" # Clean up iso file.
else echo -e "\033[1m\E[31mERROR\033[1m\E[37m burn failed"
fi
fi
sleep 2
eject -r sr0; read -t10 -p "Remove disk and hit a key to exit";
}
export -f author_it; export -f iso_it; export -f burn_it; export MOVIE="$1"
gnome-terminal --title="Quick n' Dirty MPG>ISO>DISK" \
--geometry=85x55+0+25 -x bash -c "tput civis; author_it; iso_it; burn_it"
No comments:
Post a Comment