Skip to content

Instantly share code, notes, and snippets.

@tylerjl
Created July 11, 2015 19:24
Show Gist options
  • Save tylerjl/37ef2f52cb23e52d3ca5 to your computer and use it in GitHub Desktop.
Save tylerjl/37ef2f52cb23e52d3ca5 to your computer and use it in GitHub Desktop.
#!/usr/bin/env zsh
# Script to rip DVDs with as much automatic detection as possible.
# It's a personal script
PATH=${PATH}:${HOME}/.bin
# Define filename
TITLE=${TITLE:=${(C)${$(\
HandBrakeCLI --scan --input /dev/cdrom --previews 2:0 2>&1 \
| grep 'DVD Title:' \
| sed 's/^.*DVD Title: //' \
| tr '_' '.')%%.[A-Z][A-z]}}}
_YEAR=$(filmdate.py $TITLE)
if [ $? -ne 0 ] ; then
echo $_YEAR ; exit 1 ; fi
FILENAME="${TITLE}.${_YEAR}.mkv"
[ -n "${SELECT_TITLE}" ] && title_flag="--title ${SELECT_TITLE}"
# Perform actual rip
transcode-video.sh ${=title_flag} --slow --crop detect --tune film \
--no-log --no-auto-burn \
--add-all-subtitles \
-o ${FILENAME} /dev/cdrom && \
mv "$FILENAME" "../movies/$FILENAME"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment