Skip to content

Commit

Permalink
add disc naming robustness
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjshaffer committed Jul 20, 2024
1 parent a007466 commit 4b18565
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions dvdrip
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#!/bin/bash
source /usr/share/diskripper/config

#set -xv

ripdir="${DVD_ripdir}"
Expand All @@ -22,7 +21,13 @@ episodeStartNum=0

GetDiscname()
{
discname=$(blkid -o value -s LABEL $device)
discname=$(lsdvd $device | grep "Disc Title")
discname=${discname:12}

if [[ $discname == "" ]]; then
discname=$(blkid -o value -s LABEL $device)
fi

discname=$(tr '_' ' ' <<<"$discname")
discname=$(echo "$discname" | tr '[:upper:]' '[:lower:]')
arr=( $discname )
Expand Down Expand Up @@ -64,6 +69,20 @@ RipDisk()
else
makemkvcon -r --progress=stdout --minlength=1500 --decrypt mkv dev:$device $titlenum "$ripdir" >> "$logfile";
chown -R $user:$user "$ripdir"

numFiles=`find "$ripdir" -maxdepth 1 -iname "*.${outformat}" -printf x | wc -c`

if [[ numFiles == 1 ]]; then

title=$(mkvinfo "${file}" | grep Title)
title=${title:11}

if [[ $discname == "" && $title != "" ]]; then
rmdir "$encdir"
encdir="${movie_outdir}/${title}${encdirSuffix}"
install -d -o $user -g $user "$encdir"
fi
fi
fi

sleep 2 ;
Expand All @@ -89,6 +108,7 @@ EncodeFiles()
if [[ $encFileNums != "" ]] && [[ ! ${encfiles[@]} =~ $i ]]; then
continue
fi

title=$(mkvinfo "${file}" | grep Title)
title=${title:11}

Expand Down

0 comments on commit 4b18565

Please sign in to comment.