Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| helper_scripts [2013/06/28 17:53] – beandog | helper_scripts [2018/03/28 05:54] (current) – beandog | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Helper Scripts ====== | ====== Helper Scripts ====== | ||
| + | |||
| + | This is an archive of old stuff. Some things I wrote into [[dvd_info]]. | ||
| This is just a collection of little scripts. | This is just a collection of little scripts. | ||
| + | === avi2mpg === | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | F=`basename $1 .avi` | ||
| + | MPG=${F}.mpg | ||
| + | if [[ ! -f ${MPG} ]]; then | ||
| + | mencoder $1 -o $MPG -profile dvd | ||
| + | fi | ||
| + | </ | ||
| + | |||
| + | === close_trays === | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | eject -t /dev/dvd | ||
| + | eject -t /dev/dvd1 | ||
| + | </ | ||
| + | |||
| + | === confcat === | ||
| + | |||
| + | Strip all empty strings and commented strings | ||
| + | |||
| + | < | ||
| + | #!/bin/bash | ||
| + | grep -vh ' | ||
| + | </ | ||
| === dumpchapters === | === dumpchapters === | ||
| Line 34: | Line 63: | ||
| #!/bin/sh | #!/bin/sh | ||
| mplayer dvd://${1} -dumpstream -dumpfile movie.vob | mplayer dvd://${1} -dumpstream -dumpfile movie.vob | ||
| + | </ | ||
| + | |||
| + | === dvd_id === | ||
| + | |||
| + | Once you pop in a DVD, it takes a few seconds to initialize and be able to read, even though the device shows as available. | ||
| + | |||
| + | This helper script just waits patiently until it can correctly read the DVD. | ||
| + | |||
| + | It calls the binary [[disc_id]] which you'll need installed first. | ||
| + | |||
| + | <code bash> | ||
| + | #!/bin/bash | ||
| + | EXIT_CODE=1 | ||
| + | DEVICE=$1 | ||
| + | if [[ -z $DEVICE ]]; then | ||
| + | DEVICE=/ | ||
| + | fi | ||
| + | |||
| + | if [[ ! -b $DEVICE ]]; then | ||
| + | echo " | ||
| + | exit 1 | ||
| + | fi | ||
| + | |||
| + | while [[ $EXIT_CODE != 0 ]]; do | ||
| + | / | ||
| + | EXIT_CODE=$? | ||
| + | |||
| + | if [[ $EXIT_CODE != 0 ]]; then | ||
| + | sleep 1 | ||
| + | fi | ||
| + | done | ||
| </ | </ | ||