Skip to content

Commit

Permalink
bugs
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanjshaffer committed Jul 21, 2024
1 parent 4b18565 commit d5ebbce
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 26 deletions.
5 changes: 1 addition & 4 deletions autodisk
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
#!/bin/bash
source /usr/share/diskripper/config

echo "autodisk " `date '+%s'` "$DEVNAME \n" > /home/${user}/.var/log/diskrip/.messages.log
#echo "autodisk " `date '+%s'` "$DEVNAME \n" > /home/${user}/.var/log/diskrip/.autodisk.log
{
if [ "$ID_CDROM_MEDIA_BD" -eq "1" ]; then
runuser -l $user -c "echo dvdrip ripdisk -e $DEVNAME | at now"
#echo "BD insert" > "/home/${user}/.var/log/diskrip/.insert"
exit 1
fi
}
{
if [ "$ID_CDROM_MEDIA_DVD" -eq "1" ]; then
runuser -l $user -c "echo dvdrip ripdisk -m $DEVNAME | at now"
#echo "dvd insert" > "/home/${user}/.var/log/diskrip/.insert"
fi
}
{
if [ "$ID_CDROM_MEDIA_CD" -eq "1" ]; then
runuser -l $user -c "echo cdrip $DEVNAME | at now"
#echo "cd insert" > "/home/${user}/.var/log/diskrip/.insert"
fi
}

3 changes: 2 additions & 1 deletion config
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@

ffmpegVer=7.0
makemkvVer=1.17.6
ffmpeg_string='ffmpeg -loglevel level -nostdin -y -hwaccel cuda -hwaccel_output_format cuda -i "${file}" -c:v hevc_nvenc -gpu any -rc constqp -cq 22 "${encdir}/${fileoutname}"'
ffmpeg_string='ffmpeg -loglevel level -nostdin -y -hwaccel cuda -hwaccel_output_format cuda -i "${file}" -map 0 -c:v hevc_nvenc -gpu any -rc constqp -cq 22 -c:a copy -c:s copy "${encdir}/${fileoutname}"'
hardware_encoding=true

user for video file ownership
user=""
Expand Down
34 changes: 13 additions & 21 deletions dvdrip
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/bash
source /usr/share/diskripper/config

#set -xv

ripdir="${DVD_ripdir}"
encdir="${movie_outdir}"
outformat="${DVD_outformat}"

logdir=/home/${user}/.var/log/diskrip/bd/
logdir=/home/${user}/.var/log/diskrip/dvd/

install -d -o $user -g $user ${logdir}

echo "ripping disc " >> ${logdir}/.dvdrip

ripdirSuffix=""
encdirSuffix=""
Expand All @@ -32,6 +32,9 @@ GetDiscname()
discname=$(echo "$discname" | tr '[:upper:]' '[:lower:]')
arr=( $discname )
discname=${arr[@]^}

touch ${logdir}riplist.txt
echo "ripping disc $discname " >> ${logdir}riplist.txt
}

CalcEncodeDir()
Expand Down Expand Up @@ -69,20 +72,6 @@ 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 Down Expand Up @@ -133,11 +122,11 @@ EncodeFiles()
echo "Encoding $file to ${fileoutname}" >> "$logfile";

if [[ $test == true ]]; then
eval "echo \"$ffmpeg_string\""
# echo "ffmpeg -nostdin -y -hwaccel cuda -hwaccel_output_format cuda -i \"${file}\" -c:v hevc_nvenc -gpu any -rc constqp -cq 22 \"${encdir}/${fileoutname}\""
encstr="echo ${ffmpeg_string}"
eval $encstr
else
eval "$ffmpeg_string" 2> >(tee -a "$logfile");
#ffmpeg -loglevel level -nostdin -y -hwaccel cuda -hwaccel_output_format cuda -i "${file}" -c:v hevc_nvenc -gpu any -rc constqp -cq 22 "${encdir}/${fileoutname}" 2> >(tee -a "$logfile");
encstr=${ffmpeg_string}
eval "${encstr}" 2> >(tee -a "$logfile");
RC=$?
if [ "${RC}" -eq "0" ]; then
echo "removing $file"
Expand All @@ -153,7 +142,10 @@ EncodeFiles()
((i=i+1))
done < <(find "$ripdir" -maxdepth 1 -iname "*.${outformat}" -print0 | sort -z)

rmdir ${encdir}
# remove directory if empty
if [ -z "$( ls -A ${ripdir} )" ]; then
rmdir ${ripdir}
fi
}

###################
Expand Down

0 comments on commit d5ebbce

Please sign in to comment.