Compare commits
30 Commits
tvhandling
...
patch-1
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1b203ab32f | ||
|
|
f3f308a812 | ||
|
|
ab4b572c98 | ||
|
|
b663390d9b | ||
|
|
1680d526ec | ||
|
|
add820b533 | ||
|
|
0c795ce69a | ||
|
|
cfb09d3154 | ||
|
|
cdb013d751 | ||
|
|
0269d7c1e4 | ||
|
|
573137ca71 | ||
|
|
601ce808da | ||
|
|
b44fe81bc9 | ||
|
|
1e0deaf23f | ||
|
|
fa10eba748 | ||
|
|
64ccf9f55c | ||
|
|
64fe0c97c2 | ||
|
|
f97b5ff98c | ||
|
|
f00e28a965 | ||
|
|
bf9680cb11 | ||
|
|
1376566d48 | ||
|
|
f7d96c204f | ||
|
|
f2f4413e28 | ||
|
|
635aa556dd | ||
|
|
067c7785c0 | ||
|
|
a986bb450d | ||
|
|
61a944f322 | ||
|
|
4e0a5c4321 | ||
|
|
58cba08405 | ||
|
|
1d5c60bd3f |
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/"
|
||||
OUTPUTDIR="/mnt/media/ARM/Media/Music/"
|
||||
|
||||
# The default actions that abcde will take.
|
||||
ACTIONS=cddb,playlist,getalbumart,read,encode,tag,move,clean
|
||||
ACTIONS=cddb,playlist,getalbumart,read,encode,replaygain,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-${ALBUMFILE}/${TRACKNUM}.${ARTISTFILE}-${TRACKFILE}'
|
||||
VAOUTPUTFORMAT='${OUTPUT}/Various Artists/${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-${ALBUMFILE}/${ALBUMFILE}'
|
||||
VAONETRACKOUTPUTFORMAT='${OUTPUT}/Various Artists/${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-${ALBUMFILE}/${ALBUMFILE}.m3u'
|
||||
VAPLAYLISTFORMAT='${OUTPUT}/Various Artists/${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,3 +4,4 @@ archive/
|
||||
config
|
||||
temp/
|
||||
test.py
|
||||
*.sh~
|
||||
|
||||
33
Branch_Scope.txt
Normal file
33
Branch_Scope.txt
Normal file
@@ -0,0 +1,33 @@
|
||||
2017-06-05 - Chris Bunt
|
||||
Automatic Ripping Mahcine (ARM) Project
|
||||
Development Branch: dep-omdbapi-key
|
||||
|
||||
Scope: Add the ability to query omdbapi using thier new API key structure. As
|
||||
of late May 2017, a change in policy at omdbapi requires the use of a key
|
||||
to perform queries. At this time, it is undetermined whether free (as in beer)
|
||||
access will be made again available, but if it is, it appears that it will
|
||||
still require a key.
|
||||
|
||||
This branch will update the code making the queries to get movie by type, which
|
||||
is used by the ARM to determine whether a video disc is a "movie" or a
|
||||
"TV series," (or potentially any other type of video).
|
||||
|
||||
API Key for OMDBAPI.com (Not sure how private this should be)
|
||||
OMDb API: http://www.omdbapi.com/?i=tt3896198&apikey=38d39b96
|
||||
Poster API: http://img.omdbapi.com/?i=tt3896198&h=600&apikey=38d39b96
|
||||
KEY: 38d39b96
|
||||
Generated URL:
|
||||
http://www.omdbapi.com/?t={0}&y={1}&plot=short&r=json&apikey={omdb_api_key
|
||||
http://www.omdbapi.com/?t="true grit"&plot=short&4=json&apikey=38d39b96
|
||||
video name example "Raising Arizona (1999)"
|
||||
|
||||
Files affected:
|
||||
|
||||
config.sample -- will likely need a new variable to support the eu's API key,
|
||||
this will be modelled off the exisitng API key methodology used for existing
|
||||
keyed tools like pushbullet and (presumably) MakeMKV.
|
||||
|
||||
getvideotype.py -- primary python script that gets the video type.
|
||||
|
||||
identify.sh -- Primary script that calls video type. Altered to pass the API
|
||||
key to getvideotype.py as part of the request
|
||||
28
README.md
28
README.md
@@ -34,18 +34,24 @@ 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
|
||||
|
||||
@@ -22,7 +22,7 @@ SKIP_TRANSCODE=false
|
||||
|
||||
# Base directory of ARM media directory
|
||||
# Ripped and transcoded files end up here
|
||||
ARMPATH="/mnt/media/ARM/"
|
||||
ARMPATH="/mnt/media/ARM/Media/Unidentified/"
|
||||
|
||||
# Path to raw MakeMKV directory
|
||||
# Destination for MakeMKV and source for HandBrake
|
||||
@@ -30,7 +30,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/emby/movies/"
|
||||
MEDIA_DIR="/mnt/media/ARM/Media/Movies/"
|
||||
|
||||
# Path to directory to hold log files
|
||||
# Make sure to include trailing /
|
||||
@@ -39,6 +39,16 @@ 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 ##
|
||||
########################
|
||||
@@ -54,6 +64,13 @@ 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=""
|
||||
|
||||
##########################
|
||||
## HandBrake Parameters ##
|
||||
##########################
|
||||
@@ -76,6 +93,16 @@ 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 ##
|
||||
#####################
|
||||
@@ -126,6 +153,18 @@ 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=""
|
||||
|
||||
# OMDB_API_KEY
|
||||
# omdbapi.com API Key
|
||||
# This is the API key for omdbapi.com queries.
|
||||
# More info at http://omdbapi.com/
|
||||
# OMDB_API_KEY=""
|
||||
OMDB_API_KEY="38d39b96"
|
||||
|
||||
# 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
|
||||
|
||||
15
data_rip.sh
15
data_rip.sh
@@ -7,18 +7,21 @@ source "$ARM_CONFIG"
|
||||
|
||||
{
|
||||
|
||||
|
||||
|
||||
TIMESTAMP=$(date '+%Y%m%d_%H%M%S');
|
||||
DEST="/mnt/media/ARM/${TIMESTAMP}_${ID_FS_LABEL}"
|
||||
mkdir "$DEST"
|
||||
DEST="/mnt/media/ARM/Media/Data/${TIMESTAMP}_${ID_FS_LABEL}"
|
||||
mkdir -p "$DEST"
|
||||
FILENAME=${ID_FS_LABEL}_disc.iso
|
||||
|
||||
|
||||
#dd if=/dev/sr0 of=$DEST/$FILENAME
|
||||
cat "$DEVNAME" > "$DEST/$FILENAME"
|
||||
|
||||
eject
|
||||
|
||||
eject "$DEVNAME"
|
||||
|
||||
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||
|
||||
chmod -R "$CHMOD_VALUE" "$DEST"
|
||||
|
||||
fi
|
||||
|
||||
} >> "$LOG"
|
||||
|
||||
69
default.mmcp.xml
Normal file
69
default.mmcp.xml
Normal file
@@ -0,0 +1,69 @@
|
||||
<?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>
|
||||
@@ -12,6 +12,7 @@ def entry():
|
||||
""" Entry to program, parses arguments"""
|
||||
parser = argparse.ArgumentParser(description='Get type of dvd--movie or tv series')
|
||||
parser.add_argument('-t', '--title', help='Title', required=True)
|
||||
parser.add_argument('-k', '--key', help='API_Key', dest='omdb_api_key', required=True)
|
||||
|
||||
return parser.parse_args()
|
||||
|
||||
@@ -19,6 +20,8 @@ def getdvdtype():
|
||||
""" Queries OMDbapi.org for title information and parses if it's a movie
|
||||
or a tv series """
|
||||
dvd_title = args.title
|
||||
needs_new_year = "false"
|
||||
omdb_api_key = args.omdb_api_key
|
||||
|
||||
try:
|
||||
year = dvd_title[(dvd_title.rindex('(')):len(dvd_title)]
|
||||
@@ -37,32 +40,55 @@ def getdvdtype():
|
||||
if year is None:
|
||||
year = ""
|
||||
|
||||
dvd_type = callwebservice(dvd_title, year)
|
||||
dvd_type = callwebservice(omdb_api_key, dvd_title_clean, year)
|
||||
# print (dvd_type)
|
||||
|
||||
# handle failures
|
||||
# first see if there is a hyphen and split it
|
||||
if (dvd_title.find("-") > -1):
|
||||
dvd_title_slice = dvd_title[:dvd_title.find("-")]
|
||||
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)
|
||||
# this is kind of kludgy, but it kind of work...
|
||||
if (dvd_type == "fail"):
|
||||
|
||||
return dvd_type
|
||||
# first try submitting without the year
|
||||
dvd_type = callwebservice(omdb_api_key, dvd_title_clean, "")
|
||||
# print (dvd_type)
|
||||
|
||||
if (dvd_type != "fail"):
|
||||
#that means the year is wrong.
|
||||
needs_new_year = "true"
|
||||
|
||||
if (dvd_type == "fail"):
|
||||
# second see if there is a hyphen and split it
|
||||
if (dvd_title.find("-") > -1):
|
||||
dvd_title_slice = dvd_title[:dvd_title.find("-")]
|
||||
dvd_title_slice =cleanupstring(dvd_title_slice)
|
||||
dvd_type = callwebservice(omdb_api_key, 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(omdb_api_key, dvd_title_clean)
|
||||
|
||||
if needs_new_year == "true":
|
||||
#pass the new year back to bash to handle
|
||||
global new_year
|
||||
return dvd_type + "#" + new_year
|
||||
else:
|
||||
return dvd_type
|
||||
|
||||
def cleanupstring(string):
|
||||
# clean up title string to pass to OMDbapi.org
|
||||
string = string.strip()
|
||||
return re.sub('[_ ]',"+",string)
|
||||
|
||||
def callwebservice(dvd_title, year=""):
|
||||
def callwebservice(omdb_api_key, dvd_title, year=""):
|
||||
""" Queries OMDbapi.org for title information and parses if it's a movie
|
||||
or a tv series """
|
||||
print (dvd_title)
|
||||
print (year)
|
||||
print (omdb_api_key)
|
||||
|
||||
try:
|
||||
dvd_title_info_json = urllib.request.urlopen("http://www.omdbapi.com/?t={0}&y={1}&plot=short&r=json".format(dvd_title, year)).read()
|
||||
# dvd_title_info_json = urllib.request.urlopen("http://www.omdbapi.com/?t={0}&y={1}&plot=short&r=json".format(dvd_title, year)).read()
|
||||
dvd_title_info_json = urllib.request.urlopen("http://www.omdbapi.com/?t={1}&y={2}&plot=short&r=json&apikey={0}".format(omdb_api_key, dvd_title, year)).read()
|
||||
except:
|
||||
return "fail"
|
||||
else:
|
||||
@@ -70,6 +96,8 @@ def callwebservice(dvd_title, year=""):
|
||||
if doc['Response'] == "False":
|
||||
return "fail"
|
||||
else:
|
||||
global new_year
|
||||
new_year = doc['Year']
|
||||
return doc['Type']
|
||||
|
||||
args = entry()
|
||||
|
||||
14
identify.sh
14
identify.sh
@@ -70,7 +70,19 @@ if [ "$ID_FS_TYPE" == "udf" ]; then
|
||||
fi
|
||||
|
||||
if [ $HAS_NICE_TITLE == true ]; then
|
||||
VIDEO_TYPE=$(/opt/arm/getvideotype.py -t "${VIDEO_TITLE}" 2>&1)
|
||||
# VTYPE=$(/opt/arm/getvideotype.py -t "${VIDEO_TITLE}" 2>&1)
|
||||
VTYPE=$(/opt/arm/getvideotype.py -t "${VIDEO_TITLE}" -k "${OMDB_API_KEY}" 2>&1)
|
||||
|
||||
#handle year mismath if found
|
||||
if [[ $VTYPE =~ .*#.* ]]; then
|
||||
VIDEO_TYPE=$(echo "$VTYPE" | cut -f1 -d#)
|
||||
NEW_YEAR=$(echo "$VTYPE" | cut -f2 -d#)
|
||||
echo "VIDEO_TYPE is $VIDEO_TYPE and NEW_YEAR is $NEW_YEAR"
|
||||
VIDEO_TITLE="$(echo "$VIDEO_TITLE" | cut -f1 -d\()($NEW_YEAR)"
|
||||
echo "Year mismatch found. New video title is $VIDEO_TITLE"
|
||||
else
|
||||
VIDEO_TYPE="$VTYPE"
|
||||
fi
|
||||
else
|
||||
VIDEO_TYPE="unknown"
|
||||
fi
|
||||
|
||||
10
notify.sh
10
notify.sh
@@ -26,5 +26,15 @@ 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 "$DEST"
|
||||
mkdir -p "$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}"
|
||||
echo "Sending command: makemkvcon backup --decrypt -r disc:$DISC $DEST"
|
||||
makemkvcon backup --decrypt -r disc:"$DISC" "$DEST"/
|
||||
# shellcheck disable=SC2086
|
||||
makemkvcon backup --decrypt $MKV_ARGS -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,7 +33,8 @@ VIDEO_TYPE=$3
|
||||
echo "DEST is ${DEST}"
|
||||
else
|
||||
echo "Using mkv method of ripping." >> "$LOG"
|
||||
makemkvcon mkv dev:"$DEVNAME" all "$DEST" --minlength="$MINLENGTH" -r
|
||||
# shellcheck disable=SC2086
|
||||
makemkvcon mkv $MKV_ARGS dev:"$DEVNAME" all "$DEST" --minlength="$MINLENGTH" -r
|
||||
eject "$DEVNAME"
|
||||
fi
|
||||
|
||||
|
||||
@@ -29,14 +29,15 @@ TIMESTAMP=$5
|
||||
fi
|
||||
|
||||
# DEST="${ARMPATH}/${LABEL}_${TIMESTAMP}"
|
||||
mkdir "$DEST"
|
||||
mkdir -p "$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"
|
||||
$HANDBRAKE_CLI -i "$SRC" -o "$DEST/$LABEL.$DEST_EXT" --main-feature --preset="$HB_PRESET" --subtitle scan -F 2>> "$LOG"
|
||||
# shellcheck disable=SC2086
|
||||
$HANDBRAKE_CLI -i "$SRC" -o "$DEST/$LABEL.$DEST_EXT" --main-feature --preset="$HB_PRESET" $HB_ARGS 2>> "$LOG"
|
||||
rmdir "$SRC"
|
||||
elif [ "$RIPMETHOD" = "backup" ] && [ "$MAINFEATURE" = false ] && [ "$ID_CDROM_MEDIA_BD" = "1" ]; then
|
||||
echo "Transcoding BluRay all titles above minlength." >> "$LOG"
|
||||
@@ -58,7 +59,8 @@ TIMESTAMP=$5
|
||||
echo "Title length is $SEC seconds." >> "$LOG"
|
||||
if [ $SEC -gt "$MINLENGTH" ]; then
|
||||
echo "HandBraking title $TITLE"
|
||||
$HANDBRAKE_CLI -i "$SRC" -o "$DEST/$LABEL-$TITLE.$DEST_EXT" --min-duration="$MINLENGTH" -t "$TITLE" --preset="$HB_PRESET" --subtitle scan -F 2 >> "$LOG"
|
||||
# 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"
|
||||
|
||||
# Check for main title and rename
|
||||
if [ "$MAINTITLENO" = "$TITLE" ] && [ "$HAS_NICE_TITLE" = true ]; then
|
||||
@@ -73,7 +75,8 @@ 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
|
||||
$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"
|
||||
eject "$DEVNAME"
|
||||
else
|
||||
echo "Transcoding all files." >> "$LOG"
|
||||
@@ -86,7 +89,8 @@ TIMESTAMP=$5
|
||||
filename=${filename%.*}
|
||||
|
||||
echo "Transcoding file $FILE" >> "$LOG"
|
||||
$HANDBRAKE_CLI -i "$SRC/$FILE" -o "$DEST/$filename.$DEST_EXT" --preset="$HB_PRESET" --subtitle scan -F 2>> "$LOG"
|
||||
# shellcheck disable=SC2086
|
||||
$HANDBRAKE_CLI -i "$SRC/$FILE" -o "$DEST/$filename.$DEST_EXT" --preset="$HB_PRESET" $HB_ARGS 2>> "$LOG"
|
||||
rm "$SRC/$FILE"
|
||||
done
|
||||
rmdir "$SRC"
|
||||
@@ -116,6 +120,12 @@ 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
|
||||
@@ -130,10 +140,16 @@ 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 "$MEDIA_DIR/$LABEL" >> "$LOG"
|
||||
mkdir -p "$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
|
||||
@@ -151,6 +167,13 @@ 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
|
||||
@@ -162,23 +185,70 @@ 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 -v "$MEDIA_DIR/$LABEL" >> "$LOG"
|
||||
mkdir -p -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"
|
||||
# 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
|
||||
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
|
||||
else
|
||||
echo "Emby Refresh False. Skipping library scan" >> "$LOG"
|
||||
|
||||
# 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
|
||||
|
||||
fi
|
||||
rmdir "$DEST"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user