Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
816b3ff833 | ||
|
|
fdadc08c8c | ||
|
|
5c2eff6e2f | ||
|
|
88a779d014 | ||
|
|
5c5146df52 | ||
|
|
9f6db3a078 | ||
|
|
4e0c05f787 | ||
|
|
7e76b84d70 | ||
|
|
1310c6b08d |
6
.gitignore
vendored
Normal file → Executable file
6
.gitignore
vendored
Normal file → Executable file
@@ -1 +1,5 @@
|
||||
log
|
||||
logs/*
|
||||
test.sh
|
||||
archive/
|
||||
config
|
||||
|
||||
|
||||
71
config.sample
Normal file
71
config.sample
Normal file
@@ -0,0 +1,71 @@
|
||||
#!/bin/bash
|
||||
# ARM (Automatic Ripping Machine) oonfig file
|
||||
|
||||
#####################
|
||||
## Directory setup ##
|
||||
#####################
|
||||
|
||||
#Base directory of ARM media directory
|
||||
#Ripped and transcoded files end up here
|
||||
ARMPATH="/mnt/media/ARM/"
|
||||
|
||||
#Path to raw MakeMKV directory
|
||||
#Destination for MakeMKV and source for HandBrake
|
||||
RAWPATH="/mnt/media/ARM/raw/"
|
||||
|
||||
#Path to directory to hold log files
|
||||
#Make sure to include trailing /
|
||||
LOGPATH="/opt/arm/logs/"
|
||||
|
||||
#How long to let log files live before deleting (in days)
|
||||
LOGLIFE=1
|
||||
|
||||
########################
|
||||
## MakeMKV Parameters ##
|
||||
########################
|
||||
|
||||
#Minimum length of track for MakeMKV rip (in seconds)
|
||||
MINLENGTH="600"
|
||||
|
||||
|
||||
##########################
|
||||
## HandBrake Parameters ##
|
||||
##########################
|
||||
|
||||
# Handbrake preset profile
|
||||
# See https://trac.handbrake.fr/wiki/BuiltInPresets
|
||||
HB_PRESET="High Profile"
|
||||
|
||||
#Extension of the final video file
|
||||
DEST_EXT=mkv
|
||||
|
||||
#Handbrake binary to call
|
||||
HANDBRAKE_CLI=HandBrakeCLI
|
||||
|
||||
#############################
|
||||
## Notification Parameters ##
|
||||
#############################
|
||||
|
||||
#Pushbullet API Key
|
||||
#Leave empty or comment out to disable Pushbullet notifications
|
||||
#PB_KEY=""
|
||||
|
||||
#IFTTT API KEY
|
||||
#Leave empty or comment out to disable IFTTT notifications
|
||||
#IFTTT_KEY=""
|
||||
|
||||
#IFTTT Event Name
|
||||
IFTTT_EVENT="arm_event"
|
||||
|
||||
#Determine logfile name
|
||||
#use the label of the DVD/CD or else use empty.log
|
||||
#this is required for udev events where there is no media available
|
||||
#such as ejecting the drive
|
||||
if [ -z $ID_FS_LABEL]; then
|
||||
LOGFILE="empty.log"
|
||||
else
|
||||
LOGFILE=${ID_FS_LABEL}".log"
|
||||
fi
|
||||
|
||||
#Set full logfile path
|
||||
LOG=$LOGPATH$LOGFILE
|
||||
@@ -1,7 +1,7 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
# Rip Data using DD
|
||||
|
||||
source /opt/arm/config
|
||||
|
||||
{
|
||||
|
||||
@@ -19,4 +19,4 @@
|
||||
eject
|
||||
|
||||
|
||||
} >> /opt/arm/log
|
||||
} >> $LOG
|
||||
|
||||
38
identify.sh
38
identify.sh
@@ -1,31 +1,43 @@
|
||||
#!/bin/bash
|
||||
#
|
||||
source /opt/arm/config
|
||||
|
||||
# Create log dir if needed
|
||||
mkdir -p $LOGPATH
|
||||
|
||||
{
|
||||
echo "Starting Identify Script..." >> /opt/arm/log
|
||||
echo "Starting Identify Script..." >> $LOG
|
||||
|
||||
|
||||
#Clean up old log files
|
||||
FILESFOUND=( $(find $LOGPATH -mtime +$LOGLIFE -type f))
|
||||
echo "Deleting ${#FILESFOUND[@]} old log files:"${FILESFOUND[@]} >> $LOG
|
||||
find $LOGPATH -mtime +$LOGLIFE -type f -delete
|
||||
|
||||
# Set Home to home folder of user that is setup to run MakeMKV
|
||||
export HOME="/root/"
|
||||
|
||||
|
||||
if [ $ID_FS_TYPE == "udf" ]; then
|
||||
echo "identified video" >> /opt/arm/log
|
||||
echo "ripping video" >> /opt/arm/log
|
||||
/opt/arm/video_rip.sh
|
||||
echo "identified video" >> $LOG
|
||||
echo "found ${ID_FS_LABEL} on ${DEVNAME}" >> $LOG
|
||||
#echo "ripping video" >> $LOG
|
||||
/opt/arm/video_rip.sh $LOG
|
||||
|
||||
elif (($ID_CDROM_MEDIA_TRACK_COUNT_AUDIO > 0 )); then
|
||||
echo "identified audio" >> /opt/arm/log
|
||||
echo "identified audio" >> $LOG
|
||||
abcde
|
||||
|
||||
elif [ $ID_FS_TYPE == "iso9660" ]; then
|
||||
echo "identified data" >> /opt/arm/log
|
||||
/opt/arm/data_rip.sh
|
||||
eject
|
||||
echo "identified data" >> $LOG
|
||||
/opt/arm/data_rip.sh $LOG
|
||||
eject $DEVNAME
|
||||
else
|
||||
echo "unable to identify" >> /opt/arm/log
|
||||
echo $ID_CDROM_MEDIA_TRACK_COUNT_AUDIO >> /opt/arm/log
|
||||
echo $ID_FS_TYPE >> /opt/arm/log
|
||||
eject
|
||||
echo "unable to identify" >> $LOG
|
||||
echo $ID_CDROM_MEDIA_TRACK_COUNT_AUDIO >> $LOG
|
||||
echo $ID_FS_TYPE >> $LOG
|
||||
eject $DEVNAME
|
||||
fi
|
||||
|
||||
|
||||
} >> /opt/arm/log
|
||||
} >> $LOG
|
||||
|
||||
26
notify.sh
Executable file
26
notify.sh
Executable file
@@ -0,0 +1,26 @@
|
||||
#!/bin/bash
|
||||
|
||||
source /opt/arm/config
|
||||
MSG=$1
|
||||
|
||||
{
|
||||
#Notification via pushbullet
|
||||
#Trigger onl if variable is set
|
||||
if [ -z "$PB_KEY" ]; then
|
||||
echo "Pushbullet notifications not enabled" >> $LOG
|
||||
else
|
||||
curl -s -u $PB_KEY: https://api.pushbullet.com/v2/pushes -d type=note -d title="Alert" -d body="$MSG"
|
||||
echo "Pushbullet notification sent" >> $LOG
|
||||
fi
|
||||
|
||||
#Notification via IFTTT
|
||||
#Trigger only if variable is set
|
||||
if [ -z "$IFTTT_KEY" ]; then
|
||||
echo "IFTTT notifications not enabled" >> $LOG
|
||||
else
|
||||
curl -s -X POST -H "Content-Type: application/json" -d '{"value1":"'"$MSG"'"}' https://maker.ifttt.com/trigger/${IFTTT_EVENT}/with/key/${IFTTT_KEY}
|
||||
printf "\nIFTTT notification sent" >> $LOG
|
||||
fi
|
||||
|
||||
} >> $LOG
|
||||
|
||||
16
video_rip.sh
16
video_rip.sh
@@ -2,19 +2,23 @@
|
||||
#
|
||||
# Rip video using MakeMKV then eject and call transcode script
|
||||
|
||||
source /opt/arm/config
|
||||
|
||||
{
|
||||
|
||||
TIMESTAMP=`date '+%Y%m%d_%H%M%S'`;
|
||||
DEST=/mnt/media/ARM/raw/${TIMESTAMP}_${ID_FS_LABEL}
|
||||
echo "Ripping video ${ID_FS_LABEL} from ${DEVNAME}" >> $LOG
|
||||
TIMESTAMP=`date '+%Y%m%d_%H%M%S'`;
|
||||
DEST=${RAWPATH}/${ID_FS_LABEL}_${TIMESTAMP}
|
||||
mkdir $DEST
|
||||
|
||||
|
||||
makemkvcon mkv dev:/dev/sr0 all $DEST -r
|
||||
makemkvcon mkv dev:$DEVNAME all $DEST --minlength=$MINLENGTH -r
|
||||
|
||||
eject
|
||||
eject $DEVNAME
|
||||
|
||||
echo /opt/arm/notify.sh "\"Ripped: ${ID_FS_LABEL} completed from ${DEVNAME}\"" |at now
|
||||
|
||||
echo /opt/arm/video_transcode.sh $DEST $ID_FS_LABEL $TIMESTAMP | batch
|
||||
|
||||
|
||||
|
||||
} >> /opt/arm/log
|
||||
} >> $LOG
|
||||
|
||||
@@ -1,19 +1,20 @@
|
||||
#!/bin/bash
|
||||
# Transcodes Video files using HandBrake and removes source files when done
|
||||
|
||||
|
||||
source /opt/arm/config
|
||||
#SRC=/mnt/media/ARM/raw/
|
||||
SRC=$1
|
||||
LABEL=$2
|
||||
TIMESTAMP=$3
|
||||
DEST_EXT=mkv
|
||||
HANDBRAKE_CLI=HandBrakeCLI
|
||||
#LOG=$4
|
||||
#DEST_EXT=mkv
|
||||
#HANDBRAKE_CLI=HandBrakeCLI
|
||||
#HB_PRESET="Normal"
|
||||
HB_PRESET="High Profile"
|
||||
#HB_PRESET="High Profile"
|
||||
|
||||
echo "Start video transcoding script" >> /opt/arm/log
|
||||
echo "Start video transcoding script" >> $LOG
|
||||
|
||||
DEST=/mnt/media/ARM/${TIMESTAMP}_${LABEL}
|
||||
DEST=${ARMPATH}/${LABEL}_${TIMESTAMP}
|
||||
mkdir $DEST
|
||||
|
||||
for FILE in `ls $SRC`
|
||||
@@ -22,9 +23,9 @@ echo "Start video transcoding script" >> /opt/arm/log
|
||||
extension=${filename##*.}
|
||||
filename=${filename%.*}
|
||||
|
||||
echo "Transcoding file $FILE" >> /opt/arm/log
|
||||
echo "Transcoding file $FILE" >> $LOG
|
||||
|
||||
$HANDBRAKE_CLI -i $SRC/$FILE -o $DEST/$filename.$DEST_EXT --preset="$HB_PRESET" --subtitle scan -F 2> /opt/arm/log
|
||||
$HANDBRAKE_CLI -i $SRC/$FILE -o $DEST/$filename.$DEST_EXT --preset="$HB_PRESET" --subtitle scan -F 2> $LOG
|
||||
#TIMESTAMP=`date '+%Y_%m_%d__%H_%M_%S'`;
|
||||
#mv $SRC/$FILE $SRC/done/$TIMESTAMP.$FILE
|
||||
#mv $DEST/$FILE $DEST/done/$FILE
|
||||
@@ -32,3 +33,7 @@ echo "Start video transcoding script" >> /opt/arm/log
|
||||
|
||||
done
|
||||
|
||||
rmdir $SRC
|
||||
|
||||
echo /opt/arm/notify.sh "\"Transcode: ${ID_FS_LABEL} complete.\"" |at now
|
||||
|
||||
|
||||
Reference in New Issue
Block a user