Added MakeMKV Profile, Plex and Main movie Support (#38)
* MakeMKV Args for Profiles * Updating extra Folders to support Plex Going to add a system wide variable that can be turned on to create the folder needed for Plex Extras Support. If it is not enabled, it will default to how Emby wants it, but add a ".plexignore" file to the extras folder. This will allow you to use both Plex and Emby at the same time. Same thing if you enable Plex Support, an ".ignore" file will be added to the Plex Featurettes folder to tell Emby to ignore those files since it does not match its naming convention.. * Added Plex Support Configuration This will enable the new modifications that I made to the "video_transcode.sh" script to enable Plex support, the other minor changes I made to the default Directories make it more Generic for support of Plex, Emby or Kodi use. * Updating extra Folders to support Plex Going to add a system wide variable that can be turned on to create the folder needed for Plex Extras Support. If it is not enabled, it will default to how Emby wants it, but add a ".plexignore" file to the extras folder. This will allow you to use both Plex and Emby at the same time. Same thing if you enable Plex Support, an ".ignore" file will be added to the Plex Featurettes folder to tell Emby to ignore those files since it does not match its naming convention.. * Detect and Move Main Movie File in Extras to Root Movie Folder This addition detects the largest file in the "Extras/Featurettes" folder and assumes it is the main movie, which it will then move it to the root folder for detection in Plex/Emby/Kodi... * Add Replaygain, Change Output/Various Artists Folder Changed the default output directory to make it more Plex/Emby/Kodi friendly. Added Replaygain support as a default setting so applications that can utilize it will have the necessary tags. Updated the Various Artists folder path to actually group the ablums into a "Various Artists" folder for proper use with Plex/Emby/Kodi. * Updated File Output for Various Artists Albums Plex/Emby/Kodi prefer to have a separate folder for Various Artists, previously each artist had their own folder, but Various Artists albums did not get sorted that way. This is rectifying that. * Changed Default Destination File Path This is to enhance functionality and make it more Plex/Emby/Kodi friendly. * Add Replaygain Tags For Albums & Songs This adds replaygain tags to converted files so that media players that utilize those tags will be able to take advantage of it. * Updated Install Process Updated the Install Process to account for necessary folders for Sorting of media. This also enables it to be used in a standalone setup without the need for a NAS/File Server. * Add Git and Regionset to Install Process For new installs of Ubuntu, Git and Region Set for the disc drive is not installed. This adds that and helps the user to set the proper region for their disc drive for ripping media. * Adding "-p" arguments to mkdir commands This will simply the install setup by not requiring users to create those directories, previously the script would fail to move files unless one had manually created those directories. But now the script will automatically create them if they don't exist with the addition of this change! * New Settings, File Permissions This is to enable the script to change the file permissions of outputted files for enable the user to read/write/modify the files as desired. Currently this is not possible if storing the data locally because the data is locked to the sudo/root user. * Enabled New File Permission Config Setting Enabled the use of the new configuration setting to set file permission * Added CHMOD_VALUE settings This settings allows one to adjust the default file permissions if they desire.
This commit is contained in:
committed by
Benjamin Bryan
parent
58cba08405
commit
4e0a5c4321
10
.abcde.conf
10
.abcde.conf
@@ -63,26 +63,26 @@ CDPARANOIAOPTS="--never-skip=40"
|
|||||||
CDDISCID=cd-discid
|
CDDISCID=cd-discid
|
||||||
|
|
||||||
# Give the base location here for the encoded music files.
|
# 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.
|
# 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',
|
# 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:
|
# multi-track encode and also for a multi-track, 'various-artist' encode:
|
||||||
OUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${TRACKNUM}.${TRACKFILE}'
|
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',
|
# 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.
|
# single-track encode and also for a single-track 'various-artist' encode.
|
||||||
# (Create a single-track encode with 'abcde -1' from the commandline.)
|
# (Create a single-track encode with 'abcde -1' from the commandline.)
|
||||||
ONETRACKOUTPUTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${ALBUMFILE}'
|
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
|
# Create playlists for single and various-artist encodes. I would suggest
|
||||||
# commenting these out for single-track encoding.
|
# commenting these out for single-track encoding.
|
||||||
PLAYLISTFORMAT='${OUTPUT}/${ARTISTFILE}/${ALBUMFILE}/${ALBUMFILE}.m3u'
|
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
|
# 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
|
# bag of illegal characters. It allows spaces, if you do not wish spaces add
|
||||||
|
|||||||
27
README.md
27
README.md
@@ -34,20 +34,23 @@ See: https://b3n.org/automatic-ripping-machine
|
|||||||
|
|
||||||
## Install
|
## Install
|
||||||
|
|
||||||
|
sudo apt-get install git
|
||||||
|
sudo apt-get install regionset
|
||||||
|
sudo regionset /dev/sr0
|
||||||
|
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
|
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
|
cd /opt
|
||||||
git clone https://github.com/ahnooie/automatic-ripping-machine.git arm
|
git clone https://github.com/RandomNinjaAtk/automatic-ripping-machine.git arm
|
||||||
cd arm
|
cd arm
|
||||||
pip3 install -r requirements.txt
|
pip3 install -r requirements.txt
|
||||||
ln -s /opt/arm/51-automedia.rules /lib/udev/rules.d/
|
ln -s /opt/arm/51-automedia.rules /lib/udev/rules.d/
|
||||||
|
|||||||
@@ -22,7 +22,7 @@ SKIP_TRANSCODE=false
|
|||||||
|
|
||||||
# Base directory of ARM media directory
|
# Base directory of ARM media directory
|
||||||
# Ripped and transcoded files end up here
|
# Ripped and transcoded files end up here
|
||||||
ARMPATH="/mnt/media/ARM/"
|
ARMPATH="/mnt/media/ARM/Media/Unidentified/"
|
||||||
|
|
||||||
# Path to raw MakeMKV directory
|
# Path to raw MakeMKV directory
|
||||||
# Destination for MakeMKV and source for HandBrake
|
# Destination for MakeMKV and source for HandBrake
|
||||||
@@ -30,7 +30,7 @@ RAWPATH="/mnt/media/ARM/raw/"
|
|||||||
|
|
||||||
# Path to final media directory
|
# Path to final media directory
|
||||||
# Destination for final file. Only used for movies that are positively identified
|
# 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
|
# Path to directory to hold log files
|
||||||
# Make sure to include trailing /
|
# Make sure to include trailing /
|
||||||
@@ -39,6 +39,16 @@ LOGPATH="/opt/arm/logs/"
|
|||||||
# How long to let log files live before deleting (in days)
|
# How long to let log files live before deleting (in days)
|
||||||
LOGLIFE=1
|
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 ##
|
## 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.
|
# 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"
|
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 ##
|
## HandBrake Parameters ##
|
||||||
##########################
|
##########################
|
||||||
@@ -79,6 +96,13 @@ MAINFEATURE=false
|
|||||||
# Additional HandBrake arguments.
|
# Additional HandBrake arguments.
|
||||||
HB_ARGS="--subtitle scan -F"
|
HB_ARGS="--subtitle scan -F"
|
||||||
|
|
||||||
|
#####################
|
||||||
|
## Enable Plex Use ##
|
||||||
|
#####################
|
||||||
|
|
||||||
|
# Set this setting to true, to enable Plex Extras support
|
||||||
|
PLEX_SUPPORT=false
|
||||||
|
|
||||||
#####################
|
#####################
|
||||||
## Emby Parameters ##
|
## Emby Parameters ##
|
||||||
#####################
|
#####################
|
||||||
|
|||||||
13
data_rip.sh
13
data_rip.sh
@@ -7,11 +7,9 @@ source "$ARM_CONFIG"
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
TIMESTAMP=$(date '+%Y%m%d_%H%M%S');
|
TIMESTAMP=$(date '+%Y%m%d_%H%M%S');
|
||||||
DEST="/mnt/media/ARM/${TIMESTAMP}_${ID_FS_LABEL}"
|
DEST="/mnt/media/ARM/Media/Data/${TIMESTAMP}_${ID_FS_LABEL}"
|
||||||
mkdir "$DEST"
|
mkdir -p "$DEST"
|
||||||
FILENAME=${ID_FS_LABEL}_disc.iso
|
FILENAME=${ID_FS_LABEL}_disc.iso
|
||||||
|
|
||||||
|
|
||||||
@@ -19,6 +17,11 @@ source "$ARM_CONFIG"
|
|||||||
cat "$DEVNAME" > "$DEST/$FILENAME"
|
cat "$DEVNAME" > "$DEST/$FILENAME"
|
||||||
|
|
||||||
eject
|
eject
|
||||||
|
|
||||||
|
if [ "$SET_MEDIA_PERMISSIONS" = true ]; then
|
||||||
|
|
||||||
|
chmod -R "$CHMOD_VALUE" "$DEST"
|
||||||
|
|
||||||
|
fi
|
||||||
|
|
||||||
} >> "$LOG"
|
} >> "$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>
|
||||||
@@ -17,14 +17,14 @@ VIDEO_TYPE=$3
|
|||||||
DEST="${RAWPATH}/${VIDEO_TITLE}_${TIMESTAMP}"
|
DEST="${RAWPATH}/${VIDEO_TITLE}_${TIMESTAMP}"
|
||||||
RIPSTART=$(date +%s);
|
RIPSTART=$(date +%s);
|
||||||
|
|
||||||
mkdir "$DEST"
|
mkdir -p "$DEST"
|
||||||
|
|
||||||
#echo /opt/arm/video_transcode.sh \"$DEST\" \"$VIDEO_TITLE\" $TIMESTAMP >> $LOG
|
#echo /opt/arm/video_transcode.sh \"$DEST\" \"$VIDEO_TITLE\" $TIMESTAMP >> $LOG
|
||||||
if [ "$RIPMETHOD" = "backup" ] && [ "$ID_CDROM_MEDIA_BD" = "1" ]; then
|
if [ "$RIPMETHOD" = "backup" ] && [ "$ID_CDROM_MEDIA_BD" = "1" ]; then
|
||||||
echo "Using backup method of ripping." >> "$LOG"
|
echo "Using backup method of ripping." >> "$LOG"
|
||||||
DISC="${DEVNAME: -1}"
|
DISC="${DEVNAME: -1}"
|
||||||
echo "Sending command: makemkvcon backup --decrypt -r disc:$DISC $DEST"
|
echo "Sending command: makemkvcon backup --decrypt -r disc:$DISC $DEST"
|
||||||
makemkvcon backup --decrypt -r disc:"$DISC" "$DEST"/
|
makemkvcon "$MKV_ARGS" backup --decrypt -r disc:"$DISC" "$DEST"/
|
||||||
eject "$DEVNAME"
|
eject "$DEVNAME"
|
||||||
elif [ "$MAINFEATURE" = true ] && [ "$ID_CDROM_MEDIA_DVD" = "1" ] && [ -z "$ID_CDROM_MEDIA_BD" ]; then
|
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"
|
echo "Media is DVD and Main Feature parameter in config file is true. Bypassing MakeMKV." >> "$LOG"
|
||||||
@@ -33,7 +33,7 @@ VIDEO_TYPE=$3
|
|||||||
echo "DEST is ${DEST}"
|
echo "DEST is ${DEST}"
|
||||||
else
|
else
|
||||||
echo "Using mkv method of ripping." >> "$LOG"
|
echo "Using mkv method of ripping." >> "$LOG"
|
||||||
makemkvcon mkv dev:"$DEVNAME" all "$DEST" --minlength="$MINLENGTH" -r
|
makemkvcon "$MKV_ARGS" mkv dev:"$DEVNAME" all "$DEST" --minlength="$MINLENGTH" -r
|
||||||
eject "$DEVNAME"
|
eject "$DEVNAME"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ TIMESTAMP=$5
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# DEST="${ARMPATH}/${LABEL}_${TIMESTAMP}"
|
# DEST="${ARMPATH}/${LABEL}_${TIMESTAMP}"
|
||||||
mkdir "$DEST"
|
mkdir -p "$DEST"
|
||||||
if [ "$SKIP_TRANSCODE" = true ] && [ "$RIPMETHOD" = "mkv" ]; then
|
if [ "$SKIP_TRANSCODE" = true ] && [ "$RIPMETHOD" = "mkv" ]; then
|
||||||
# this only works for files ripped by MakeMKV into .mkv files
|
# this only works for files ripped by MakeMKV into .mkv files
|
||||||
echo "Skipping transcode. Moving files from $SRC to $DEST" >> "$LOG"
|
echo "Skipping transcode. Moving files from $SRC to $DEST" >> "$LOG"
|
||||||
@@ -120,6 +120,12 @@ TIMESTAMP=$5
|
|||||||
if [ ! -f "$MEDIA_DIR/$LABEL.$DEST_EXT" ]; then
|
if [ ! -f "$MEDIA_DIR/$LABEL.$DEST_EXT" ]; then
|
||||||
echo "No file found. Moving \"$DEST/$LABEL.$DEST_EXT to $MEDIA_DIR/$LABEL.$DEST_EXT\"" >> "$LOG"
|
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"
|
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
|
if [ "$EMBY_REFRESH" = true ]; then
|
||||||
# signal emby to scan library
|
# signal emby to scan library
|
||||||
@@ -134,10 +140,16 @@ TIMESTAMP=$5
|
|||||||
# shellcheck disable=SC2129,SC2016
|
# shellcheck disable=SC2129,SC2016
|
||||||
echo '$VIDEO_TYPE is movie, $MAINFEATURE is true, $HAS_NICE_TITLE is true, $EMBY_SUBFOLDERS is true' >> "$LOG"
|
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"
|
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
|
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"
|
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"
|
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
|
if [ "$EMBY_REFRESH" = true ]; then
|
||||||
# signal emby to scan library
|
# signal emby to scan library
|
||||||
@@ -155,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 "***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"
|
echo "Moving multiple files to emby movie folder" >> "$LOG"
|
||||||
mv -n "$DEST/$LABEL.$DEST_EXT" "$MEDIA_DIR/$LABEL.$DEST_EXT"
|
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
|
if [ "$EMBY_REFRESH" = true ]; then
|
||||||
# signal emby to scan library
|
# signal emby to scan library
|
||||||
embyrefresh
|
embyrefresh
|
||||||
@@ -166,23 +185,70 @@ TIMESTAMP=$5
|
|||||||
echo '$VIDEO_TYPE is movie, $MAINFEATURE is false, $HAS_NICE_TITLE is true, $EMBY_SUBFOLDERS is true' >> "$LOG"
|
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 "Moving multiple files to emby movie subfolders" >> "$LOG"
|
||||||
echo "First move main title" >> "$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
|
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"
|
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"
|
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
|
fi
|
||||||
|
|
||||||
#now move "extras"
|
#now move "extras"
|
||||||
# shellcheck disable=SC2129,SC2016
|
if [ "$PLEX_SUPPORT" = true ]; then
|
||||||
mkdir -v "$MEDIA_DIR/$LABEL/extras" >> "$LOG"
|
|
||||||
# shellcheck disable=SC2086
|
# shellcheck disable=SC2129,SC2016
|
||||||
echo "Sending command: mv -n "\"$DEST/$LABEL/*\"" "\"$MEDIA_DIR/$LABEL/extras/\""" >> "$LOG"
|
mkdir -p -v "$MEDIA_DIR/$LABEL/Featurettes" >> "$LOG"
|
||||||
mv -n "${DEST}"/* "$MEDIA_DIR/$LABEL/extras/" >> "$LOG"
|
|
||||||
if [ "$EMBY_REFRESH" = true ]; then
|
# Create Emby ignore file for "extras" Folder
|
||||||
# signal emby to scan library
|
touch "$MEDIA_DIR/$LABEL/Featurettes/.ignore" >> "$LOG"
|
||||||
embyrefresh
|
|
||||||
|
# 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
|
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
|
fi
|
||||||
rmdir "$DEST"
|
rmdir "$DEST"
|
||||||
fi
|
fi
|
||||||
|
|||||||
Reference in New Issue
Block a user