6
# Part of the tovid suite
7
# =======================
8
# A bash script for creating a VCD cue/bin set and burning it
11
# Project homepage: http://www.tovid.org
14
# Copyright (C) 2005 tovid.org <http://www.tovid.org>
16
# This program is free software; you can redistribute it and/or
17
# modify it under the terms of the GNU General Public License
18
# as published by the Free Software Foundation; either
19
# version 2 of the License, or (at your option) any later
22
# This program is distributed in the hope that it will be useful,
23
# but WITHOUT ANY WARRANTY; without even the implied warranty of
24
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25
# GNU General Public License for more details.
27
# You should have received a copy of the GNU General Public License
28
# along with this program; if not, write to the Free Software
29
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. Or see:
31
# http://www.gnu.org/licenses/gpl.txt
33
SCRIPTNAME=`cat << EOF
34
--------------------------------
36
A script to create cue/bin files for a (S)VCD and burn them to a CD
37
Part of the tovid suite, version $TOVID_VERSION
39
--------------------------------
43
Usage: makevcd [OPTIONS] {VCDIMAGER.xml}
45
Where OPTIONS may be any of the following:
47
-overwrite Overwrite existing cue/bin image
48
-burn (default only make image)
49
-device DEVICE (default /dev/cdrw)
50
-speed NUM (default 12)
54
VCDIMAGER.xml is the name of a file containing a VCDImager XML
55
description (For XML format, see http://www.vcdimager.org/).
56
If you use(d) 'makexml' to create the XML file, you can use
59
See the makevcd manual page ('man makevcd') for additional documentation.
63
SEPARATOR="=========================================="
65
# Print script name, usage notes, and optional error message, then exit.
66
# Args: $1 == text string containing error message
75
# Print out a runtime error specified as an argument, and exit
79
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
80
echo "makevcd encountered an error during the VCD creation process:"
82
echo "See if anything in the above output helps you diagnose the"
83
echo "problem, and please file a bug report containing the above"
84
echo "output with http://www.tovid.org. Sorry for the inconvenience!"
85
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
91
CDRW_DEVICE="/dev/cdrw"
96
# ==========================================================
97
# EXECUTION BEGINS HERE
100
assert_dep "$vcd" "You are missing dependencies required to image and burn (S)VCDs!"
102
while test x"${1:0:1}" = "x-"; do
104
"-quiet" ) QUIET=: ;;
120
usage_error "Error: Unrecognized command-line option $1"
128
if test $# -ne 1; then
129
usage_error "Please provide the name of a VCDimager XML file \
130
containing the (S)VCD description."
132
# XML input is last argument
136
# Look for earlier attempts to image this VCD
137
for prev_try in "$VCDIMAGER_XML.cue" "$VCDIMAGER_XML.bin"; do
138
if test -f "$prev_try"; then
139
echo "Found a previous makevcd attempt: $prev_try!"
141
echo -n "Removing it... "
144
echo "Will use this for burning the disc."
147
echo "Use '-overwrite' to override and re-image; or"
148
echo "use '-burn' to write this existing image."
156
# Create the cue/bin image
158
# TODO: Warn if there isn't enough space to make cue/bin
159
VCDIMAGER_CMD="vcdxbuild -c \"$VCDIMAGER_XML.cue\" -b \
160
\"$VCDIMAGER_XML.bin\" \"$VCDIMAGER_XML\""
162
echo "Creating cue/bin disc image with the following command:"
164
if eval $VCDIMAGER_CMD; then
166
$QUIET || echo "Use 'makevcd -burn $VCDIMAGER_XML' to burn your VCD."
167
$QUIET || echo "Thanks for using tovid!"
169
runtime_error "Imaging failed, please see vcdxbuild output above."
175
# Sanity check: Make sure given device is valid (somehow)
176
# before creating the cue/bin. Give option to proceed anyway?
177
# (i.e., could there be any point to proceeding?)
178
# Here's a simple way: just quit
179
if test -b $CDRW_DEVICE; then :
181
echo "Couldn't find $CDRW_DEVICE! Stopping here."
185
# Remind user to insert a CD
186
$QUIET || echo "Please insert a blank CD-R(W) disc into your CD-recorder"
187
$QUIET || echo "($CDRW_DEVICE) if you have not already done so."
189
# check for cdrw and blank if so
190
if cdrdao disk-info --device /dev/hdc --driver generic-mmc 2>&1 |
191
grep -q CD-RW.*yes; then
193
echo "Found rewritable CD - starting to blank in 10 seconds - press ctrl-c to quit"
195
cdrdao blank --driver generic-mmc $CDRW_DEVICE
198
CDRDAO_CMD="cdrdao write --device $CDRW_DEVICE --driver generic-mmc \
199
--speed $BURN_SPEED \"$VCDIMAGER_XML.cue\""
201
echo "Burning cue/bin image to $CDRW_DEVICE with the following command:"
203
if eval $CDRDAO_CMD; then
205
echo "Done. You should now have a working VCD or SVCD. Please report"
206
echo "any problems you might have to http://www.tovid.org."
207
echo "Thanks for using tovid!"
212
runtime_error "Could not burn the disc to $CDRW_DEVICE at speed $BURN_SPEED."