Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
Last revision Both sides next revision
helper_scripts [2013/06/28 11:53]
beandog
helper_scripts [2018/03/27 23:54]
beandog
Line 1: Line 1:
 ====== Helper Scripts ====== ====== Helper Scripts ======
 +
 +This is an archive of old stuff. Most things now 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
 +</​code>​
 +
 +=== close_trays ===
 +
 +<code bash>
 +#!/bin/bash
 +eject -t /dev/dvd
 +eject -t /dev/dvd1
 +</​code>​
 +
 +=== confcat ===
 +
 +Strip all empty strings and commented strings
 +
 +<​code>​
 +#!/bin/bash
 +grep -vh '​^#'​ "​[email protected]"​ | grep -v '​^$'​
 +</​code>​
  
 === dumpchapters === === dumpchapters ===
Line 27: Line 56:
 fi fi
 echo mencoder dvd://${1} -ovc copy -nosound -vobsubout movie -o /dev/null -slang en -quiet ${CHAPTERS} echo mencoder dvd://${1} -ovc copy -nosound -vobsubout movie -o /dev/null -slang en -quiet ${CHAPTERS}
 +</​code>​
 +
 +=== dumpvob ===
 +
 +<code bash>
 +#!/bin/sh
 +mplayer dvd://${1} -dumpstream -dumpfile movie.vob
 +</​code>​
 +
 +=== 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=/​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
 </​code>​ </​code>​

Navigation