Skip to content

Instantly share code, notes, and snippets.

@jameswhite
Forked from tacofumi/diskripper.sh
Created March 21, 2020 04:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jameswhite/1252b7e604533d31d434195130c85ba3 to your computer and use it in GitHub Desktop.
Save jameswhite/1252b7e604533d31d434195130c85ba3 to your computer and use it in GitHub Desktop.
This script rips DVD/Blu-ray using makemkvcon. Use udev to invoke this script to auto-rip when disk is inserted. Some variables such as length of string to trim in order to get the title of movie may vary depending on your environment.
#!/bin/bash
{
echo $(date)
echo ">>>Disk found"
echo ">>>Setting the title..."
title=$(makemkvcon -r info)
title=`echo "$title" | grep "DRV:0\+"`
title=${title:53}
len=${#title}-12
title=${title:0:$len}
if [[ -z $title ]]; then
echo ">>>Couldn't set the title - No disk found"
echo ">>>Exit->"
exit;
else
echo ">>>Title set: $title"
echo ">>>Starting ripping..."
makemkvcon --minlength=4800 -r --decrypt --directio=true mkv disc:0 all /home/user/share > /dev/null
mv "/home/user/raid/share/"*.mkv "/home/user/raid/share/"$title.mkv
mv "/home/user/raid/share/"$title.mkv "/home/user/raid/share/Movies"
eject
echo ">>>title: $title.mkv created."
fi
} &>> "/home/user/autorip.log"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment