Compare commits
9 Commits
feature-Au
...
tvhandling
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
03df92dded | ||
|
|
62a11d6a9a | ||
|
|
8a32a28019 | ||
|
|
b9c6beb58c | ||
|
|
48d6768d38 | ||
|
|
cc408285c5 | ||
|
|
cff56120ba | ||
|
|
660aa152da | ||
|
|
9e6a2899f5 |
10
.abcde.conf
10
.abcde.conf
@@ -63,26 +63,26 @@ CDPARANOIAOPTS="--never-skip=40"
|
||||
CDDISCID=cd-discid
|
||||
|
||||
# Give the base location here for the encoded music files.
|
||||
OUTPUTDIR="/mnt/media/ARM/Media/Music/"
|
||||
OUTPUTDIR="/mnt/media/ARM/"
|
||||
|
||||
# The default actions that abcde will take.
|
||||
ACTIONS=cddb,playlist,getalbumart,read,encode,replaygain,tag,move,clean
|
||||
ACTIONS=cddb,playlist,getalbumart,read,encode,tag,move,clean
|
||||
|
||||
# Decide here how you want the tracks labelled for a standard 'single-artist',
|
||||
# multi-track encode and also for a multi-track, 'various-artist' encode:
|
||||
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
|
||||
VAOUTPUTFORMAT='${OUTPUT}/Various Artists/${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
|
||||
VAOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
|
||||
|
||||
# Decide here how you want the tracks labelled for a standard 'single-artist',
|
||||
# single-track encode and also for a single-track 'various-artist' encode.
|
||||
# (Create a single-track encode with 'abcde -1' from the commandline.)
|
||||
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${ALBUMFILE}'
|
||||
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various Artists/${ALBUMFILE}/${ALBUMFILE}'
|
||||
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}'
|
||||
|
||||
# Create playlists for single and various-artist encodes. I would suggest
|
||||
# commenting these out for single-track encoding.
|
||||
PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${ALBUMFILE}.m3u'
|
||||
VAPLAYLISTFORMAT='${OUTPUT}/Various Artists/${ALBUMFILE}/${ALBUMFILE}.m3u'
|
||||
VAPLAYLISTFORMAT='${OUTPUT}/Various-${ALBUMFILE}/${ALBUMFILE}.m3u'
|
||||
|
||||
# This function takes out dots preceding the album name, and removes a grab
|
||||
# bag of illegal characters. It allows spaces, if you do not wish spaces add
|
||||
|
||||
1
.gitignore
vendored
1
.gitignore
vendored
@@ -4,4 +4,3 @@ archive/
|
||||
config
|
||||
temp/
|
||||
test.py
|
||||
*.sh~
|
||||
|
||||
28
README.md
28
README.md
@@ -34,24 +34,18 @@ See: https://b3n.org/automatic-ripping-machine
|
||||
|
||||
## Install
|
||||
|
||||
If you have a new DVD drive that you haven't used before, some require setting the region before they can play anything. Be aware most DVD players only let you change the region a handful (4 or 5?) of times then lockout any further changes. If your region is already set or you have a region free DVD drive you can skip this step.
|
||||
|
||||
sudo apt-get install regionset
|
||||
sudo regionset /dev/sr0
|
||||
|
||||
sudo apt-get install git
|
||||
sudo add-apt-repository ppa:heyarje/makemkv-beta
|
||||
sudo add-apt-repository ppa:stebbins/handbrake-releases
|
||||
sudo add-apt-repository ppa:mc3man/xerus-media
|
||||
sudo apt update
|
||||
sudo apt install makemkv-bin makemkv-oss
|
||||
sudo apt install handbrake-cli libavcodec-extra
|
||||
sudo apt install abcde flac imagemagick glyrc cdparanoia
|
||||
sudo apt install at
|
||||
sudo apt install python3 python3-pip
|
||||
sudo apt-get install libdvd-pkg
|
||||
sudo dpkg-reconfigure libdvd-pkg
|
||||
sudo su
|
||||
add-apt-repository ppa:heyarje/makemkv-beta
|
||||
add-apt-repository ppa:stebbins/handbrake-releases
|
||||
add-apt-repository ppa:mc3man/xerus-media
|
||||
apt update
|
||||
apt install makemkv-bin makemkv-oss
|
||||
apt install handbrake-cli libavcodec-extra
|
||||
apt install abcde flac imagemagick glyrc cdparanoia
|
||||
apt install at
|
||||
apt install python3 python3-pip
|
||||
apt-get install libdvd-pkg
|
||||
dpkg-reconfigure libdvd-pkg
|
||||
cd /opt
|
||||
git clone https://github.com/ahnooie/automatic-ripping-machine.git arm
|
||||
cd arm
|
||||
|
||||
123
arm/tv_dvd.py
Executable file
123
arm/tv_dvd.py
Executable file
@@ -0,0 +1,123 @@
|
||||
#!/usr/bin/python3
|
||||
|
||||
import sys
|
||||
import argparse
|
||||
import os
|
||||
# import re
|
||||
import subprocess
|
||||
import logging
|
||||
import pprint
|
||||
import time
|
||||
|
||||
def entry():
|
||||
""" Entry to program, parses arguments"""
|
||||
parser = argparse.ArgumentParser(description='Get type of dvd--movie or tv series')
|
||||
parser.add_argument('-d', '--devpath', help='Devpath', required=True)
|
||||
parser.add_argument('-m', '--minlength', help='Minimum Length', default=0, type=int)
|
||||
parser.add_argument('-x', '--maxlength', help='Maximum Length', default=0, type=int)
|
||||
parser.add_argument('-a', '--armpath', help='ArmPath', required=True)
|
||||
parser.add_argument('-r', '--rawpath', help='Rawpath', required=True)
|
||||
parser.add_argument('-e', '--label', help='Label', required=True)
|
||||
parser.add_argument('-b', '--handbrakecli', help='HandbrakeCLI', default="HandBrakeCLI")
|
||||
parser.add_argument('-p', '--hb_preset', help='Handbrake Preset', required=True)
|
||||
parser.add_argument('-g', '--hb_args', help='Handbrake Arguements', default='')
|
||||
parser.add_argument('-l', '--logfile', help='Logfile (path/logname)', required=True)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
def log_params():
|
||||
"""log all entry parameters"""
|
||||
|
||||
logging.info("Logging tv_dvd parameters")
|
||||
logging.info("**** Start tv_dvd.py paramaters *** ")
|
||||
logging.info("devpath: " + args.devpath)
|
||||
logging.info("minlength: " + str(args.minlength))
|
||||
logging.info("maxlength: " + str(args.maxlength))
|
||||
logging.info("armpath: " + args.armpath)
|
||||
logging.info("rawpath: " + args.rawpath)
|
||||
logging.info("handbrakecli: " + args.handbrakecli)
|
||||
logging.info("hb_preset: " + args.hb_preset)
|
||||
logging.info("logfile: " + args.logfile)
|
||||
logging.info("hb_args: " + args.hb_args)
|
||||
logging.info("*** End of tv_dvd.py parameters ***")
|
||||
|
||||
def main():
|
||||
"""main tv processing function"""
|
||||
logging.info("Starting TV_DVD processing")
|
||||
|
||||
try:
|
||||
d = subprocess.check_output(["lsdvd", '-Oy', args.devpath]).decode("utf-8")
|
||||
except subprocess.CalledProcessError as derror:
|
||||
print("Call to lsdvd failed with code: " + str(derror.returncode), derror.output)
|
||||
err = "Aborting. Call to lsdvd failed with code: " + str(derror.returncode), derror.output
|
||||
sys.exit(err)
|
||||
|
||||
data = d.replace("lsdvd = ", "", 1)
|
||||
info = eval(data, {})
|
||||
# print(info['track'])
|
||||
|
||||
#get filesystem in order
|
||||
ts = round(time.time() * 100)
|
||||
basepath = os.path.join(args.armpath, args.label + "_" + str(ts))
|
||||
if not os.path.exists(basepath):
|
||||
try:
|
||||
os.makedirs(basepath)
|
||||
except:
|
||||
logging.error("Couldn't create the base file path: " + basepath + " Probably a permissions error")
|
||||
err = "Couldn't create the base file path: " + basepath + " Probably a permissions error"
|
||||
sys.exit(err)
|
||||
|
||||
total = 0
|
||||
for index, item in enumerate(info['track']):
|
||||
if item['ix'] > total:
|
||||
total = item['ix']
|
||||
|
||||
logging.info("Found " + str(total) + " tracks.")
|
||||
|
||||
for index, item in enumerate(info['track']):
|
||||
|
||||
if item['length'] < args.minlength:
|
||||
#too short
|
||||
logging.info("Track #" + str(item['ix']) + " of " + str(total) + ". Length (" + str(item['length']) + \
|
||||
") is less than minimum length (" + str(args.minlength) + "). Skipping")
|
||||
elif item['length'] > args.maxlength:
|
||||
#too long
|
||||
logging.info("Track #" + str(item['ix']) +" of " + str(total) + ". Length (" + str(item['length']) + \
|
||||
") is greater than maximum length (" + str(args.maxlength) + "). Skipping")
|
||||
else:
|
||||
#just right
|
||||
logging.info("Processing track #" + str(item['ix']) + " of " + str(total) + ". Length is " + str(item['length']) + " seconds.")
|
||||
|
||||
|
||||
filename = os.path.join(basepath, "title_" + str(item['ix']) + ".mkv")
|
||||
|
||||
cmd = 'nice {0} -i "{1}" -o "{2}" --preset "{3}" -t {4} {5}>> {6}'.format(
|
||||
args.handbrakecli,
|
||||
args.devpath,
|
||||
filename,
|
||||
args.hb_preset,
|
||||
str(item['ix']),
|
||||
args.hb_args,
|
||||
args.logfile
|
||||
)
|
||||
|
||||
logging.debug("Sending command: %s", (cmd))
|
||||
|
||||
try:
|
||||
hb = subprocess.check_output(
|
||||
cmd,
|
||||
shell=True
|
||||
).decode("utf-8")
|
||||
except subprocess.CalledProcessError as hb_error:
|
||||
err = "Call to hadnbrake failed with code: " + str(hb_error.returncode) + "(" + str(hb_error.output) + ")"
|
||||
logging.error(err)
|
||||
sys.exit(err)
|
||||
|
||||
args = entry()
|
||||
|
||||
#set up logging
|
||||
logging.basicConfig(filename=args.logfile, format='[%(asctime)s] ARM: %(levelname)s %(message)s', datefmt='%Y-%m-%d %H:%M:%S', \
|
||||
level=logging.INFO)
|
||||
|
||||
log_params()
|
||||
main()
|
||||
@@ -16,13 +16,16 @@ GET_VIDEO_TITLE=true
|
||||
# Note: RIPMETHOD must be set to "mkv" for this feature to work
|
||||
SKIP_TRANSCODE=false
|
||||
|
||||
# Default Video Type. Use this to give ARM a way to handle dvds/bds that aren't identifiable.
|
||||
# DEFAULT_VIDEOTYPE="series"
|
||||
|
||||
#####################
|
||||
## Directory setup ##
|
||||
#####################
|
||||
|
||||
# Base directory of ARM media directory
|
||||
# Ripped and transcoded files end up here
|
||||
ARMPATH="/mnt/media/ARM/Media/Unidentified/"
|
||||
ARMPATH="/mnt/media/ARM/"
|
||||
|
||||
# Path to raw MakeMKV directory
|
||||
# Destination for MakeMKV and source for HandBrake
|
||||
@@ -30,7 +33,7 @@ RAWPATH="/mnt/media/ARM/raw/"
|
||||
|
||||
# Path to final media directory
|
||||
# Destination for final file. Only used for movies that are positively identified
|
||||
MEDIA_DIR="/mnt/media/ARM/Media/Movies/"
|
||||
MEDIA_DIR="/mnt/media/ARM/emby/movies/"
|
||||
|
||||
# Path to directory to hold log files
|
||||
# Make sure to include trailing /
|
||||
@@ -39,16 +42,6 @@ LOGPATH="/opt/arm/logs/"
|
||||
# How long to let log files live before deleting (in days)
|
||||
LOGLIFE=1
|
||||
|
||||
########################
|
||||
## File Permissions ##
|
||||
########################
|
||||
|
||||
# Enabling this seting will allow you to adjust the default file permissions of the outputted files
|
||||
# The default value is set to 777 for read/write/execute for all users, but can be changed below using the "CHMOD_VALUE" setting
|
||||
# This setting is helpfuly when storing the data locally on the system
|
||||
SET_MEDIA_PERMISSIONS=false
|
||||
CHMOD_VALUE=777
|
||||
|
||||
########################
|
||||
## MakeMKV Parameters ##
|
||||
########################
|
||||
@@ -56,6 +49,9 @@ CHMOD_VALUE=777
|
||||
# Minimum length of track for MakeMKV rip (in seconds)
|
||||
MINLENGTH="600"
|
||||
|
||||
# Maximum length of track for MakeMKV rip (in seconds). Set to 0 to disable
|
||||
MAXLENGTH="0"
|
||||
|
||||
# Method of MakeMKV to use for Blu Ray discs. Options are "mkv" or "backup".
|
||||
# mkv is the normal method of ripping mkv files directly from the DVD
|
||||
# backup decrypts the dvd and then copies it to the hard drive. This allows HandBrake to apply some of it's
|
||||
@@ -64,12 +60,10 @@ MINLENGTH="600"
|
||||
# DVD's will always default back to the "mkv" mode. If this is set to "backup" then you must also set HandBrake's MAINFEATURE to true.
|
||||
RIPMETHOD="mkv"
|
||||
|
||||
# MakeMKV Arguments
|
||||
# MakeMKV Profile used for controlling Audio Track Selection.
|
||||
# This is the default profile MakeMKV uses for Audio track selection. Updating this file or changing it is considered
|
||||
# to be advanced usage of MakeMKV. But this will allow users to alternatively tell makemkv to select HD audio tracks and etc.
|
||||
# MKV_ARGS="--profile=/opt/arm/default.mmcp.xml"
|
||||
MKV_ARGS=""
|
||||
# Additional HandBrake arguments. '--subtitle scan -F --subtitle-burned' will scan for forced foreign language
|
||||
# audio and burn them into the video
|
||||
# HB_ARGS="--subtitle scan -F --subtitle-burned"
|
||||
HB_ARGS="--subtitle scan -F --subtitle-burned"
|
||||
|
||||
##########################
|
||||
## HandBrake Parameters ##
|
||||
@@ -93,16 +87,6 @@ HANDBRAKE_CLI=HandBrakeCLI
|
||||
# However, it does not handle tv shows well at all. You will likely want this value to be false when ripping tv shows.
|
||||
MAINFEATURE=false
|
||||
|
||||
# Additional HandBrake arguments.
|
||||
HB_ARGS="--subtitle scan -F"
|
||||
|
||||
#####################
|
||||
## Enable Plex Use ##
|
||||
#####################
|
||||
|
||||
# Set this setting to true, to enable Plex Extras support
|
||||
PLEX_SUPPORT=false
|
||||
|
||||
#####################
|
||||
## Emby Parameters ##
|
||||
#####################
|
||||
@@ -153,24 +137,14 @@ PB_KEY=""
|
||||
# IFTTT Event Name
|
||||
IFTTT_EVENT="arm_event"
|
||||
|
||||
# Pushover API User and Application Key
|
||||
# Leave User key empty or comment out to disable Pushover notifications
|
||||
PO_USER_KEY=""
|
||||
PO_APP_KEY=""
|
||||
|
||||
# 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 [ -n "$ID_FS_LABEL" ]; then
|
||||
LOGFILE=${ID_FS_LABEL}".log"
|
||||
elif [[ -n "$ID_CDROM_MEDIA_TRACK_COUNT_AUDIO" && $(which abcde-musicbrainz-tool) ]]; then
|
||||
LOGFILE=$(abcde-musicbrainz-tool --device "$DEVNAME" | cut -f1 -d ' ')".log"
|
||||
elif [[ -n "$ID_CDROM_MEDIA_TRACK_COUNT_AUDIO" && $(which cd-discid) ]]; then
|
||||
LOGFILE=$(cd-discid "$DEVNAME" | cut -f1 -d ' ')".log"
|
||||
else
|
||||
if [ -z "$ID_FS_LABEL" ]; then
|
||||
LOGFILE="empty.log"
|
||||
else
|
||||
LOGFILE=${ID_FS_LABEL}".log"
|
||||
fi
|
||||
|
||||
# Set full logfile path
|
||||
|
||||
15
data_rip.sh
15
data_rip.sh
@@ -7,21 +7,18 @@ source "$ARM_CONFIG"
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
TIMESTAMP=$(date '+%Y%m%d_%H%M%S');
|
||||
DEST="/mnt/media/ARM/Media/Data/${TIMESTAMP}_${ID_FS_LABEL}"
|
||||
mkdir -p "$DEST"
|
||||
DEST="/mnt/media/ARM/${TIMESTAMP}_${ID_FS_LABEL}"
|
||||
mkdir "$DEST"
|
||||
FILENAME=${ID_FS_LABEL}_disc.iso
|
||||
|
||||
|
||||
#dd if=/dev/sr0 of=$DEST/$FILENAME
|
||||
cat "$DEVNAME" > "$DEST/$FILENAME"
|
||||
|
||||
eject "$DEVNAME"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$DEST"
|
||||
|
||||
fi
|
||||
eject
|
||||
|
||||
|
||||
} >> "$LOG"
|
||||
|
||||
@@ -1,69 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<profile>
|
||||
<!-- profile name - Default -->
|
||||
<name lang="mogz">:5086</name>
|
||||
|
||||
<!-- Common MKV flags -->
|
||||
<mkvSettings
|
||||
ignoreForcedSubtitlesFlag="true"
|
||||
useISO639Type2T="false"
|
||||
setFirstAudioTrackAsDefault="true"
|
||||
setFirstSubtitleTrackAsDefault="true"
|
||||
setFirstForcedSubtitleTrackAsDefault="true"
|
||||
insertFirstChapter00IfMissing="true"
|
||||
/>
|
||||
|
||||
<!-- Settings overridable in preferences -->
|
||||
<profileSettings
|
||||
app_DefaultSelectionString="-sel:all,+sel:(favlang|nolang|single),-sel:(havemulti|havecore),-sel:mvcvideo,=100:all,-10:favlang"
|
||||
/>
|
||||
|
||||
<!-- Output formats currently supported by MakeMKV -->
|
||||
<outputSettings name="copy" outputFormat="directCopy">
|
||||
<description lang="eng">Copy track as is</description>
|
||||
<description lang="ger">Track 1:1 kopieren</description>
|
||||
</outputSettings>
|
||||
|
||||
<outputSettings name="lpcm" outputFormat="LPCM-raw">
|
||||
<description lang="eng">Save as raw LPCM</description>
|
||||
<description lang="ger">Als RAW LPCM speichern</description>
|
||||
</outputSettings>
|
||||
|
||||
<outputSettings name="wavex" outputFormat="LPCM-wavex">
|
||||
<description lang="eng">Save as LPCM in WAV container</description>
|
||||
<description lang="ger">Als LPCM im WAV-Container speichern</description>
|
||||
</outputSettings>
|
||||
|
||||
<outputSettings name="flac-best" outputFormat="FLAC">
|
||||
<description lang="eng">Save as FLAC (best compression)</description>
|
||||
<description lang="ger">Als FLAC speichern (höchste Komprimierungsstufe)</description>
|
||||
<extraArgs>-compression_level 12</extraArgs>
|
||||
</outputSettings>
|
||||
|
||||
<outputSettings name="flac-fast" outputFormat="FLAC">
|
||||
<description lang="eng">Save as FLAC (fast compression)</description>
|
||||
<extraArgs>-compression_level 5</extraArgs>
|
||||
</outputSettings>
|
||||
|
||||
<!-- Default rule - copy as is -->
|
||||
<trackSettings input="default">
|
||||
<output outputSettingsName="copy"
|
||||
defaultSelection="$app_DefaultSelectionString">
|
||||
</output>
|
||||
</trackSettings>
|
||||
|
||||
<!-- Save LPCM mono or stereo as raw LPCM -->
|
||||
<trackSettings input="LPCM-stereo">
|
||||
<output outputSettingsName="lpcm"
|
||||
defaultSelection="$app_DefaultSelectionString">
|
||||
</output>
|
||||
</trackSettings>
|
||||
|
||||
<!-- Put multi-channel LPCM into WAVEX container-->
|
||||
<trackSettings input="LPCM-multi">
|
||||
<output outputSettingsName="wavex"
|
||||
defaultSelection="$app_DefaultSelectionString">
|
||||
</output>
|
||||
</trackSettings>
|
||||
|
||||
</profile>
|
||||
@@ -26,7 +26,7 @@ def getdvdtype():
|
||||
except:
|
||||
year = ""
|
||||
else:
|
||||
year = re.sub('[()]','', year)
|
||||
year = re.sub('[()]', '', year)
|
||||
|
||||
try:
|
||||
dvd_title = dvd_title[0:(dvd_title.rindex('('))].strip()
|
||||
@@ -49,22 +49,22 @@ def getdvdtype():
|
||||
dvd_type = callwebservice(dvd_title_clean, "")
|
||||
# print (dvd_type)
|
||||
|
||||
if (dvd_type != "fail"):
|
||||
#that means the year is wrong.
|
||||
if dvd_type != "fail":
|
||||
#that means the year is wrong.
|
||||
needs_new_year = "true"
|
||||
|
||||
if (dvd_type == "fail"):
|
||||
if dvd_type == "fail":
|
||||
# second see if there is a hyphen and split it
|
||||
if (dvd_title.find("-") > -1):
|
||||
if dvd_title.find("-") > -1:
|
||||
dvd_title_slice = dvd_title[:dvd_title.find("-")]
|
||||
dvd_title_slice =cleanupstring(dvd_title_slice)
|
||||
dvd_title_slice = cleanupstring(dvd_title_slice)
|
||||
dvd_type = callwebservice(dvd_title_slice)
|
||||
|
||||
|
||||
# if still fail, then try slicing off the last word in a loop
|
||||
while dvd_type == "fail" and dvd_title_clean.count('+') > 0:
|
||||
dvd_title_clean = dvd_title_clean.rsplit('+', 1)[0]
|
||||
dvd_type = callwebservice(dvd_title_clean)
|
||||
|
||||
|
||||
if needs_new_year == "true":
|
||||
#pass the new year back to bash to handle
|
||||
global new_year
|
||||
|
||||
21
identify.sh
21
identify.sh
@@ -84,6 +84,7 @@ if [ "$ID_FS_TYPE" == "udf" ]; then
|
||||
fi
|
||||
else
|
||||
VIDEO_TYPE="unknown"
|
||||
|
||||
fi
|
||||
|
||||
echo "got to here"
|
||||
@@ -92,7 +93,24 @@ if [ "$ID_FS_TYPE" == "udf" ]; then
|
||||
echo "video type is ${VIDEO_TYPE}"
|
||||
|
||||
umount "/mnt/$DEVNAME"
|
||||
/opt/arm/video_rip.sh "$VIDEO_TITLE" "$HAS_NICE_TITLE" "$VIDEO_TYPE" "$LOG"
|
||||
|
||||
if [ $VIDEO_TYPE = "series" ] && [ "$ID_CDROM_MEDIA_DVD" = "1" ]; then
|
||||
echo "Processing TV series. Calling tv_dvd.py" >> "$LOG"
|
||||
STR="/opt/arm/arm/tv_dvd.py -d "\"${DEVNAME}\"" -m ${MINLENGTH} -x ${MAXLENGTH} -a "\"${ARMPATH}\"" -r "\"${RAWPATH}\"" -e "\"${ID_FS_LABEL}\"" -b "\"${HANDBRAKE_CLI}\"" -p "\"${HB_PRESET}\"" -g "\"${HB_ARGS}\"" -l "\"${LOG}\"""
|
||||
echo "Sending command ${STR}"
|
||||
eval "${STR}" 2>> "$LOG"
|
||||
eject "$DEVNAME"
|
||||
elif
|
||||
[ "$VIDEO_TYPE" = "unknown" ] && [ "$DEFAULT_VIDEOTYPE" == "series" ] && [ "$ID_CDROM_MEDIA_DVD" = "1" ]; then
|
||||
echo "Video type is 'unknown' and default video type is series. Processing TV series. Calling tv_dvd.py" >> "$LOG"
|
||||
STR="/opt/arm/arm/tv_dvd.py -d "\"${DEVNAME}\"" -m ${MINLENGTH} -x ${MAXLENGTH} -a "\"${ARMPATH}\"" -r "\"${RAWPATH}\"" -e "\"${ID_FS_LABEL}\"" -b "\"${HANDBRAKE_CLI}\"" -p "\"${HB_PRESET}\"" -g "\"${HB_ARGS}\"" -l "\"${LOG}\"""
|
||||
echo "Sending command ${STR}"
|
||||
eval "${STR}" 2>> "$LOG"
|
||||
eject "$DEVNAME"
|
||||
else
|
||||
echo "Sending to video_rip queue" >> "$LOG"
|
||||
/opt/arm/video_rip.sh "$VIDEO_TITLE" "$HAS_NICE_TITLE" "$VIDEO_TYPE" "$LOG"
|
||||
fi
|
||||
else
|
||||
umount "/mnt/$DEVNAME"
|
||||
echo "identified udf as data" >> "$LOG"
|
||||
@@ -102,6 +120,7 @@ if [ "$ID_FS_TYPE" == "udf" ]; then
|
||||
fi
|
||||
else
|
||||
echo "ARM_CHECK_UDF is false, assuming udf is video" >> "$LOG"
|
||||
|
||||
/opt/arm/video_rip.sh "$LOG"
|
||||
fi
|
||||
|
||||
|
||||
10
notify.sh
10
notify.sh
@@ -26,15 +26,5 @@ else
|
||||
printf "\nIFTTT notification sent" >> "$LOG"
|
||||
fi
|
||||
|
||||
#Notification via Pushover
|
||||
#Trigger onl if variable is set
|
||||
if [ -z "$PO_USER_KEY" ]; then
|
||||
echo "Pusover notifications not enabled" >> "$LOG"
|
||||
else
|
||||
echo "Sending Pushover notification" >> "$LOG"
|
||||
curl -s --form-string "token=$PO_APP_KEY" --form-string "user=$PO_USER_KEY" --form-string "message=$MSG" https://api.pushover.net/1/messages.json
|
||||
echo "Pushover notification sent" >> "$LOG"
|
||||
fi
|
||||
|
||||
} >> "$LOG"
|
||||
|
||||
|
||||
@@ -17,14 +17,14 @@ VIDEO_TYPE=$3
|
||||
DEST="${RAWPATH}/${VIDEO_TITLE}_${TIMESTAMP}"
|
||||
RIPSTART=$(date +%s);
|
||||
|
||||
mkdir -p "$DEST"
|
||||
mkdir "$DEST"
|
||||
|
||||
#echo /opt/arm/video_transcode.sh \"$DEST\" \"$VIDEO_TITLE\" $TIMESTAMP >> $LOG
|
||||
if [ "$RIPMETHOD" = "backup" ] && [ "$ID_CDROM_MEDIA_BD" = "1" ]; then
|
||||
echo "Using backup method of ripping." >> "$LOG"
|
||||
DISC="${DEVNAME: -1}"
|
||||
# shellcheck disable=SC2086
|
||||
makemkvcon backup --decrypt $MKV_ARGS -r disc:"$DISC" "$DEST"/
|
||||
echo "Sending command: makemkvcon backup --decrypt -r disc:$DISC $DEST"
|
||||
makemkvcon backup --decrypt -r disc:"$DISC" "$DEST"/
|
||||
eject "$DEVNAME"
|
||||
elif [ "$MAINFEATURE" = true ] && [ "$ID_CDROM_MEDIA_DVD" = "1" ] && [ -z "$ID_CDROM_MEDIA_BD" ]; then
|
||||
echo "Media is DVD and Main Feature parameter in config file is true. Bypassing MakeMKV." >> "$LOG"
|
||||
@@ -33,8 +33,7 @@ VIDEO_TYPE=$3
|
||||
echo "DEST is ${DEST}"
|
||||
else
|
||||
echo "Using mkv method of ripping." >> "$LOG"
|
||||
# shellcheck disable=SC2086
|
||||
makemkvcon mkv $MKV_ARGS dev:"$DEVNAME" all "$DEST" --minlength="$MINLENGTH" -r
|
||||
makemkvcon mkv dev:"$DEVNAME" all "$DEST" --minlength="$MINLENGTH" -r
|
||||
eject "$DEVNAME"
|
||||
fi
|
||||
|
||||
|
||||
@@ -29,15 +29,14 @@ TIMESTAMP=$5
|
||||
fi
|
||||
|
||||
# DEST="${ARMPATH}/${LABEL}_${TIMESTAMP}"
|
||||
mkdir -p "$DEST"
|
||||
mkdir "$DEST"
|
||||
if [ "$SKIP_TRANSCODE" = true ] && [ "$RIPMETHOD" = "mkv" ]; then
|
||||
# this only works for files ripped by MakeMKV into .mkv files
|
||||
echo "Skipping transcode. Moving files from $SRC to $DEST" >> "$LOG"
|
||||
mv "$SRC"/* "$DEST"/ >> "$LOG"
|
||||
elif [ "$RIPMETHOD" = "backup" ] && [ "$MAINFEATURE" = true ] && [ "$ID_CDROM_MEDIA_BD" = "1" ]; then
|
||||
echo "Transcoding BluRay main feature only." >> "$LOG"
|
||||
# shellcheck disable=SC2086
|
||||
$HANDBRAKE_CLI -i "$SRC" -o "$DEST/$LABEL.$DEST_EXT" --main-feature --preset="$HB_PRESET" $HB_ARGS 2>> "$LOG"
|
||||
$HANDBRAKE_CLI -i "$SRC" -o "$DEST/$LABEL.$DEST_EXT" --main-feature --preset="$HB_PRESET" --subtitle scan -F 2>> "$LOG"
|
||||
rmdir "$SRC"
|
||||
elif [ "$RIPMETHOD" = "backup" ] && [ "$MAINFEATURE" = false ] && [ "$ID_CDROM_MEDIA_BD" = "1" ]; then
|
||||
echo "Transcoding BluRay all titles above minlength." >> "$LOG"
|
||||
@@ -59,8 +58,7 @@ TIMESTAMP=$5
|
||||
echo "Title length is $SEC seconds." >> "$LOG"
|
||||
if [ $SEC -gt "$MINLENGTH" ]; then
|
||||
echo "HandBraking title $TITLE"
|
||||
# shellcheck disable=SC2086
|
||||
$HANDBRAKE_CLI -i "$SRC" -o "$DEST/$LABEL-$TITLE.$DEST_EXT" --min-duration="$MINLENGTH" -t "$TITLE" --preset="$HB_PRESET" $HB_ARGS 2 >> "$LOG"
|
||||
$HANDBRAKE_CLI -i "$SRC" -o "$DEST/$LABEL-$TITLE.$DEST_EXT" --min-duration="$MINLENGTH" -t "$TITLE" --preset="$HB_PRESET" --subtitle scan -F 2 >> "$LOG"
|
||||
|
||||
# Check for main title and rename
|
||||
if [ "$MAINTITLENO" = "$TITLE" ] && [ "$HAS_NICE_TITLE" = true ]; then
|
||||
@@ -75,8 +73,7 @@ TIMESTAMP=$5
|
||||
elif [ "$MAINFEATURE" = true ] && [ "$ID_CDROM_MEDIA_DVD" = "1" ]; then
|
||||
echo "Transcoding DVD main feature only." >> "$LOG"
|
||||
# echo "$HANDBRAKE_CLI -i $DEVNAME -o \"${DEST}/${LABEL}.${DEST_EXT}\" --main-feature --preset="${HB_PRESET}" --subtitle scan -F 2" >> $LOG
|
||||
# shellcheck disable=SC2086
|
||||
$HANDBRAKE_CLI -i "$DEVNAME" -o "${DEST}/${LABEL}.${DEST_EXT}" --main-feature --preset="${HB_PRESET}" $HB_ARGS 2>> "$LOG"
|
||||
$HANDBRAKE_CLI -i "$DEVNAME" -o "${DEST}/${LABEL}.${DEST_EXT}" --main-feature --preset="${HB_PRESET}" --subtitle scan -F 2>> "$LOG"
|
||||
eject "$DEVNAME"
|
||||
else
|
||||
echo "Transcoding all files." >> "$LOG"
|
||||
@@ -89,8 +86,7 @@ TIMESTAMP=$5
|
||||
filename=${filename%.*}
|
||||
|
||||
echo "Transcoding file $FILE" >> "$LOG"
|
||||
# shellcheck disable=SC2086
|
||||
$HANDBRAKE_CLI -i "$SRC/$FILE" -o "$DEST/$filename.$DEST_EXT" --preset="$HB_PRESET" $HB_ARGS 2>> "$LOG"
|
||||
$HANDBRAKE_CLI -i "$SRC/$FILE" -o "$DEST/$filename.$DEST_EXT" --preset="$HB_PRESET" --subtitle scan -F 2>> "$LOG"
|
||||
rm "$SRC/$FILE"
|
||||
done
|
||||
rmdir "$SRC"
|
||||
@@ -120,12 +116,6 @@ TIMESTAMP=$5
|
||||
if [ ! -f "$MEDIA_DIR/$LABEL.$DEST_EXT" ]; then
|
||||
echo "No file found. Moving \"$DEST/$LABEL.$DEST_EXT to $MEDIA_DIR/$LABEL.$DEST_EXT\"" >> "$LOG"
|
||||
mv -n "$DEST/$LABEL.$DEST_EXT" "$MEDIA_DIR/$LABEL.$DEST_EXT"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$MEDIA_DIR"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$EMBY_REFRESH" = true ]; then
|
||||
# signal emby to scan library
|
||||
@@ -140,16 +130,10 @@ TIMESTAMP=$5
|
||||
# shellcheck disable=SC2129,SC2016
|
||||
echo '$VIDEO_TYPE is movie, $MAINFEATURE is true, $HAS_NICE_TITLE is true, $EMBY_SUBFOLDERS is true' >> "$LOG"
|
||||
echo "Moving a single file to emby subfolders" >> "$LOG"
|
||||
mkdir -p "$MEDIA_DIR/$LABEL" >> "$LOG"
|
||||
mkdir "$MEDIA_DIR/$LABEL" >> "$LOG"
|
||||
if [ ! -f "$MEDIA_DIR/$LABEL/$LABEL.$DEST_EXT" ]; then
|
||||
echo "No file found. Moving \"$DEST/$LABEL.$DEST_EXT to $MEDIA_DIR/$LABEL/$LABEL.$DEST_EXT\"" >> "$LOG"
|
||||
mv -n "$DEST/$LABEL.$DEST_EXT" "$MEDIA_DIR/$LABEL/$LABEL.$DEST_EXT"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$MEDIA_DIR/$LABEL"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$EMBY_REFRESH" = true ]; then
|
||||
# signal emby to scan library
|
||||
@@ -167,13 +151,6 @@ TIMESTAMP=$5
|
||||
echo "***WARNING!*** This will likely leave files in the transcoding directory as there is very likely existing files in the media directory"
|
||||
echo "Moving multiple files to emby movie folder" >> "$LOG"
|
||||
mv -n "$DEST/$LABEL.$DEST_EXT" "$MEDIA_DIR/$LABEL.$DEST_EXT"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$MEDIA_DIR"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$EMBY_REFRESH" = true ]; then
|
||||
# signal emby to scan library
|
||||
embyrefresh
|
||||
@@ -185,70 +162,23 @@ TIMESTAMP=$5
|
||||
echo '$VIDEO_TYPE is movie, $MAINFEATURE is false, $HAS_NICE_TITLE is true, $EMBY_SUBFOLDERS is true' >> "$LOG"
|
||||
echo "Moving multiple files to emby movie subfolders" >> "$LOG"
|
||||
echo "First move main title" >> "$LOG"
|
||||
mkdir -p -v "$MEDIA_DIR/$LABEL" >> "$LOG"
|
||||
mkdir -v "$MEDIA_DIR/$LABEL" >> "$LOG"
|
||||
if [ ! -f "$MEDIA_DIR/$LABEL/$LABEL.$DEST_EXT" ]; then
|
||||
echo "No file found. Moving \"$DEST/$LABEL.$DEST_EXT to $MEDIA_DIR/$LABEL/$LABEL.$DEST_EXT\"" >> "$LOG"
|
||||
mv -n "$DEST/$LABEL.$DEST_EXT" "$MEDIA_DIR/$LABEL/$LABEL.$DEST_EXT" >> "$LOG"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$MEDIA_DIR/$LABEL"
|
||||
|
||||
fi
|
||||
|
||||
fi
|
||||
|
||||
#now move "extras"
|
||||
if [ "$PLEX_SUPPORT" = true ]; then
|
||||
|
||||
# shellcheck disable=SC2129,SC2016
|
||||
mkdir -p -v "$MEDIA_DIR/$LABEL/Featurettes" >> "$LOG"
|
||||
|
||||
# Create Emby ignore file for "extras" Folder
|
||||
touch "$MEDIA_DIR/$LABEL/Featurettes/.ignore" >> "$LOG"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
echo "Sending command: mv -n "\"$DEST/$LABEL/*\"" "\"$MEDIA_DIR/$LABEL/Featurettes/\""" >> "$LOG"
|
||||
mv -n "${DEST}"/* "$MEDIA_DIR/$LABEL/Featurettes/" >> "$LOG"
|
||||
|
||||
# Move Largest file to main folder for Plex/Emby/Kodi to detect main movie
|
||||
# shellcheck disable=SC2012
|
||||
ls -S "$MEDIA_DIR/$LABEL/Featurettes/" | head -1 | xargs -I '{}' mv "$MEDIA_DIR/$LABEL/Featurettes/"{} "$MEDIA_DIR/$LABEL/$LABEL.mkv" >> "$LOG"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$MEDIA_DIR/$LABEL"
|
||||
|
||||
fi
|
||||
# shellcheck disable=SC2129,SC2016
|
||||
mkdir -v "$MEDIA_DIR/$LABEL/extras" >> "$LOG"
|
||||
# shellcheck disable=SC2086
|
||||
echo "Sending command: mv -n "\"$DEST/$LABEL/*\"" "\"$MEDIA_DIR/$LABEL/extras/\""" >> "$LOG"
|
||||
mv -n "${DEST}"/* "$MEDIA_DIR/$LABEL/extras/" >> "$LOG"
|
||||
if [ "$EMBY_REFRESH" = true ]; then
|
||||
# signal emby to scan library
|
||||
embyrefresh
|
||||
else
|
||||
|
||||
# shellcheck disable=SC2129,SC2016
|
||||
mkdir -p -v "$MEDIA_DIR/$LABEL/extras" >> "$LOG"
|
||||
|
||||
# Create Plex ignore file for "extras" Folder
|
||||
touch "$MEDIA_DIR/$LABEL/extras/.plexignore" >> "$LOG"
|
||||
|
||||
# shellcheck disable=SC2086
|
||||
echo "Sending command: mv -n "\"$DEST/$LABEL/*\"" "\"$MEDIA_DIR/$LABEL/extras/\""" >> "$LOG"
|
||||
mv -n "${DEST}"/* "$MEDIA_DIR/$LABEL/extras/" >> "$LOG"
|
||||
|
||||
# Move Largest file to main folder for Plex/Emby/Kodi to detect main movie
|
||||
# shellcheck disable=SC2012
|
||||
ls -S "$MEDIA_DIR/$LABEL/extras/" | head -1 | xargs -I '{}' mv "$MEDIA_DIR/$LABEL/extras/"{} "$MEDIA_DIR/$LABEL/$LABEL.mkv" >> "$LOG"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$MEDIA_DIR/$LABEL"
|
||||
|
||||
fi
|
||||
|
||||
if [ "$EMBY_REFRESH" = true ]; then
|
||||
# signal emby to scan library
|
||||
embyrefresh
|
||||
else
|
||||
echo "Emby Refresh False. Skipping library scan" >> "$LOG"
|
||||
fi
|
||||
|
||||
echo "Emby Refresh False. Skipping library scan" >> "$LOG"
|
||||
fi
|
||||
rmdir "$DEST"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user