From 6476b5b49d31753edfef38da13558d11a6485e7d Mon Sep 17 00:00:00 2001 From: Benjamyn Love Date: Sun, 26 May 2019 21:40:14 +1000 Subject: [PATCH] Initial commit --- .gitignore | 3 +++ README.md | 19 +++++++++++++++ convert.sh | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 90 insertions(+) create mode 100644 .gitignore create mode 100644 README.md create mode 100755 convert.sh diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..19ed245 --- /dev/null +++ b/.gitignore @@ -0,0 +1,3 @@ +*-mkv/ +out.log +*.iso diff --git a/README.md b/README.md new file mode 100644 index 0000000..aef0d62 --- /dev/null +++ b/README.md @@ -0,0 +1,19 @@ +# AutoMKV +AutoMKV is a simple bash script that was designed to automate the conversion of ISO images to MKV + +Usage is quite simple, most of the defaults are assumed but can be overritten + +```bash +./convert.sh -i image.iso -t 0 -o mkvs +``` + +|Flags| Description| +|---------------|----------------------| +| -i \| --input | Input image file | +| -o \| --output | Output folder | +| -t \| --title | Title to dump | +| -h \| --help | Shows this help menu | + +Requirements + +https://www.makemkv.com/ \ No newline at end of file diff --git a/convert.sh b/convert.sh new file mode 100755 index 0000000..8ce359d --- /dev/null +++ b/convert.sh @@ -0,0 +1,68 @@ +#!/bin/bash +# Benjamyn Love +# 25/05/2019 + +# The script needs to have at minimum 2 args +#if [[ $# -le 1 ]] +#then +# printf "Expecting at least two args\n" +# printf "Usage: ./convert.sh inputfile title\n" +# exit +#fi + +usage() { + printf ' -i | --input\t\t\tInput image file\n' + printf ' -o | --output\t\t\tOutput folder\n' + printf ' -t | --title\t\t\tTitle to dump\n' + printf ' -h | --help\t\t\tShows this help menu\n' +} + +while [ "$1" != "" ]; do + case $1 in + -i | --input ) shift + INFILE=$1 + ;; + -t | --title ) shift + TITLE=$1 + ;; + -h | --help ) usage + exit + ;; + -o | --output ) shift + OUTFOLDER=$1-mkv + ;; + * ) usage + exit 1 + esac + shift +done + +if [[ -z $INFILE ]] +then + printf "Input missing please specify using -i\n" + exit +fi +if [[ -z $TITLE ]] +then + printf "Title missing assuming 0, specify with -t\n" + TITLE=0 +fi + +if [[ -z $OUTFOLDER ]] +then + printf "Output folder missing assuming input file -mkv" + OUTFOLDER=$INFILE-mkv +fi + +echo "Converting ISO to MKV" +echo "Creating out folder $OUTFOLDER" + +mkdir $OUTFOLDER + +if [[ -f $INFILE ]] +then + printf "Starting conversion\n" + makemkvcon mkv --progress=-same iso:$INFILE $TITLE $OUTFOLDER/ | tee "out.log" +else + printf "File not found!\n" +fi \ No newline at end of file