Instantly share code, notes, and snippets.

Embed
What would you like to do?
#!/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