|
|
|
@ -6,8 +6,8 @@ TITLESHORT="VPP"
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
|
|
Configuration () {
|
|
|
|
|
log "############################################ SABnzbd Job: $1"
|
|
|
|
|
log "############################################ SABnzbd Category: $2"
|
|
|
|
|
log "############################################ SABnzbd Job: $jobname"
|
|
|
|
|
log "############################################ SABnzbd Category: $category"
|
|
|
|
|
log "############################################ DOCKER: $TITLE"
|
|
|
|
|
log "############################################ SCRIPT: Video Post Processor ($TITLESHORT)"
|
|
|
|
|
log "############################################ SCRIPT VERSION: 1.0.0"
|
|
|
|
@ -40,32 +40,35 @@ Configuration () {
|
|
|
|
|
|
|
|
|
|
log () {
|
|
|
|
|
m_time=`date "+%F %T"`
|
|
|
|
|
echo $m_time" "$1 | tee -a /config/scripts/logs/video-pp.log
|
|
|
|
|
chmod 666 /config/scripts/logs/video-pp.log
|
|
|
|
|
chown abc:abc /config/scripts/logs/video-pp.log
|
|
|
|
|
echo $m_time" "$1
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Configuration "$3" "$5"
|
|
|
|
|
Main () {
|
|
|
|
|
folderpath="$1"
|
|
|
|
|
jobname="$3"
|
|
|
|
|
category="$5"
|
|
|
|
|
|
|
|
|
|
if [ ${VIDEO_SMA} = TRUE ]; then
|
|
|
|
|
Configuration
|
|
|
|
|
|
|
|
|
|
if [ ${VIDEO_SMA} = TRUE ]; then
|
|
|
|
|
touch "$1/sma-conversion-check"
|
|
|
|
|
elif [ ${VIDEO_MKVCLEANER} = TRUE ]; then
|
|
|
|
|
elif [ ${VIDEO_MKVCLEANER} = TRUE ]; then
|
|
|
|
|
touch "$1/sma-conversion-check"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
# check for video files
|
|
|
|
|
if find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\|avi\)" | read; then
|
|
|
|
|
# check for video files
|
|
|
|
|
if find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\|avi\)" | read; then
|
|
|
|
|
sleep 0.1
|
|
|
|
|
else
|
|
|
|
|
else
|
|
|
|
|
log "ERROR: No video files found for processing"
|
|
|
|
|
exit 1
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
filecount=$(find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\|avi\)" | wc -l)
|
|
|
|
|
log "Processing ${filecount} video files..."
|
|
|
|
|
count=0
|
|
|
|
|
find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\|avi\)" -print0 | while IFS= read -r -d '' video; do
|
|
|
|
|
filecount=$(find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\|avi\)" | wc -l)
|
|
|
|
|
log "Processing ${filecount} video files..."
|
|
|
|
|
count=0
|
|
|
|
|
find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\|avi\)" -print0 | while IFS= read -r -d '' video; do
|
|
|
|
|
count=$(($count+1))
|
|
|
|
|
log ""
|
|
|
|
|
log "===================================================="
|
|
|
|
@ -347,9 +350,9 @@ find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\|avi\)" -print0 | while IFS= read -
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
log "===================================================="
|
|
|
|
|
done
|
|
|
|
|
done
|
|
|
|
|
|
|
|
|
|
if [ ${VIDEO_SMA} = TRUE ] || [ ${VIDEO_MKVCLEANER} = TRUE ]; then
|
|
|
|
|
if [ ${VIDEO_SMA} = TRUE ] || [ ${VIDEO_MKVCLEANER} = TRUE ]; then
|
|
|
|
|
find "$1" -type f ! -newer "$1/sma-conversion-check" ! -name "sma-conversion-check" -delete
|
|
|
|
|
# check for video files
|
|
|
|
|
if find "$1" -type f -iregex ".*/.*\.\(mkv\|mp4\)" | read; then
|
|
|
|
@ -361,6 +364,11 @@ if [ ${VIDEO_SMA} = TRUE ] || [ ${VIDEO_MKVCLEANER} = TRUE ]; then
|
|
|
|
|
if [ -f "$1/sma-conversion-check" ]; then
|
|
|
|
|
rm "$1/sma-conversion-check"
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
fi
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Main "$@" | tee -a /config/scripts/logs/video-pp.log
|
|
|
|
|
chmod 666 /config/scripts/logs/video-pp.log
|
|
|
|
|
chown abc:abc /config/scripts/logs/video-pp.log
|
|
|
|
|
|
|
|
|
|
exit $?
|
|
|
|
|