This is an old revision of the document!


Helper Scripts

This is just a collection of little scripts.

avi2mpg

#!/bin/bash
F=`basename $1 .avi`
MPG=${F}.mpg
if [[ ! -f ${MPG} ]]; then
	mencoder $1 -o $MPG -profile dvd
	fi

close_trays

#!/bin/bash
eject -t /dev/dvd
eject -t /dev/dvd1

confcat

Strip all empty strings and commented strings

#!/bin/bash
grep -vh '^#' "[email protected]" | grep -v '^$'

dumpchapters

#!/bin/sh
if [[ -n $1 ]]; then
	dvdxchap /dev/dvd -t ${1} > chapters.txt
else
	dvdxchap /dev/dvd > chapters.txt
fi

dumpsub

#!/bin/sh
CHAPTERS=""
if [[ ! -z $2 ]]; then
	CHAPTERS="-chapter ${2}"
	if [[ ! -z $3 ]]; then
		CHAPTERS="-chapter ${2}-${3}"
	fi
fi
echo mencoder dvd://${1} -ovc copy -nosound -vobsubout movie -o /dev/null -slang en -quiet ${CHAPTERS}

dumpvob

#!/bin/sh
mplayer dvd://${1} -dumpstream -dumpfile movie.vob

dvd_id

#!/bin/bash
EXIT_CODE=1
DEVICE=$1
if [[ -z $DEVICE ]]; then
	DEVICE=/dev/dvd
fi
 
if [[ ! -b $DEVICE ]]; then
	echo "Device $DEVICE doesn't exist" >&2
	exit 1
fi
 
while [[ $EXIT_CODE != 0 ]]; do
	/usr/local/bin/disc_id $DEVICE 2> /dev/null
	EXIT_CODE=$?
 
	if [[ $EXIT_CODE != 0 ]]; then
		sleep 1
	fi
done

Navigation