Created
March 22, 2018 03:32
-
-
Save jfeilbach/ae33abd43e13788e10816e6255700990 to your computer and use it in GitHub Desktop.
post filebot execute
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# Input Parameters | |
ARG_PATH="$3" | |
ARG_NAME="$2" | |
ARG_LABEL="N/A" | |
CONFIG_OUTPUT="${HOME}/Media" # Filebot's final destination for the renamed file | |
# filebot used to extract any rar | |
filebot -extract "${ARG_PATH}/${ARG_NAME}/" --output "${ARG_PATH}/${ARG_NAME}/" | |
# Mediainfo needed to check if files are encoded in hevc | |
test=$(mediainfo "${ARG_PATH}/${ARG_NAME}.mkv" --Inform="Video;%Format%") | |
echo " ${ARG_NAME} is $(mediainfo "${ARG_PATH}/${ARG_NAME}/${ARG_NAME}.mkv" --Inform="Video;%Format%")" >> ~/logs/scripts.log # log if file is recognized as HEVC | |
if [[ "${test}" == "HEVC" ]] # If the media file is x265 (HEVC) | |
then | |
# Run ffmpeg version 3.4 to remux only files detected as HEVC to the AppleTV required hvc1 rather than unsupported hev1 | |
ffmpeg -i "${ARG_PATH}/${ARG_NAME}/${ARG_NAME}.mkv" -codec copy -vtag hvc1 -map 0:0 -map 0:1 "${ARG_PATH}/${ARG_NAME}/${ARG_NAME}.mp4" | |
# If it is HEVC also run this Filebot AMC script (ignore moving/renaming only *.mkv and ignore extract as files are already extracted above) | |
filebot -script fn:amc --output "${CONFIG_OUTPUT}" --def ignore="[.](mkv)$" --def skipExtract=y --action duplicate --conflict skip -non-strict --log-file ~/amc.log --def unsorted=y music=y artwork=y excludeList=".excludes" ut_dir="${ARG_PATH}" ut_kind="multi" ut_title="${ARG_NAME}" ut_label="${ARG_LABEL}" plex="" #enter your plex ip address and token to notify it to update | |
else | |
# If not is HEVC run this Filebot AMC script | |
filebot -script fn:amc --output "${CONFIG_OUTPUT}" --def ignore="[.](mp4)$" --def skipExtract=y --action duplicate --conflict skip -non-strict --log-file ~/logs/amc.log --def unsorted=y music=y artwork=y excludeList=".excludes" ut_dir="${ARG_PATH}" ut_kind="multi" ut_title="${ARG_NAME}" ut_label="${ARG_LABEL}" plex="" | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment