Bugfix
This commit is contained in:
@@ -13,6 +13,61 @@ reset="\033[0m"
|
|||||||
|
|
||||||
shopt -s globstar
|
shopt -s globstar
|
||||||
|
|
||||||
|
# https://stackoverflow.com/questions/59895/how-can-i-get-the-directory-where-a-bash-script-is-located-from-within-the-scrip
|
||||||
|
#DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
||||||
|
#SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
||||||
|
#DIR_SCRIPT=$(dirname -- "$( readlink -f -- "$0"; )")
|
||||||
|
|
||||||
|
####
|
||||||
|
# Configuration
|
||||||
|
|
||||||
|
# Source video folder
|
||||||
|
[[ "$input_path" == "" ]] && SRC="$HOME/Downloads" || SRC="$input_path"
|
||||||
|
|
||||||
|
# Destination video folder
|
||||||
|
[[ "$output_path" == "" ]] && DEST="$HOME/Movies" || DEST="$output_path"
|
||||||
|
|
||||||
|
# Extension video file
|
||||||
|
DEST_EXT=mp4
|
||||||
|
|
||||||
|
# Handbrake preset
|
||||||
|
[[ "$profile" == "" ]] && PRESET="Apple 720p30 Surround" || PRESET="$profile"
|
||||||
|
|
||||||
|
# Only files larger than $MAXSIZE will be processed (> 30Mo)
|
||||||
|
MAXSIZE=30000000
|
||||||
|
#MAXSIZE=300
|
||||||
|
|
||||||
|
# Open converted video file in an application
|
||||||
|
APP="Subler"
|
||||||
|
|
||||||
|
SUBTITLE_LIST="eng,fre"
|
||||||
|
|
||||||
|
# log
|
||||||
|
# this reduce handbrake verbosity
|
||||||
|
#logfile=/tmp/HandBrake.log
|
||||||
|
logfolder=/var/log/handbrake_for_plex
|
||||||
|
logfile="$logfolder"/HandBrake.log
|
||||||
|
|
||||||
|
if [ ! -w "$logfile" ]; then
|
||||||
|
sudo mkdir "$logfolder"
|
||||||
|
sudo chown bruno:staff "$logfolder"
|
||||||
|
sudo touch "$logfile"
|
||||||
|
sudo chown bruno:staff "$logfile"
|
||||||
|
sudo chmod 640 "$logfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
logsize=$(wc -c <"$logfile")
|
||||||
|
|
||||||
|
if [ $logsize -ge 1000 ]; then
|
||||||
|
cp "$logfile" "$logfile.old"
|
||||||
|
truncate -s 0 "$logfile"
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
#Move to trash after conversion
|
||||||
|
trash=false
|
||||||
|
|
||||||
|
|
||||||
command -v jq >/dev/null 2>&1 || { echo -e "${bold}93mhandbrake_for_plex${reset} require ${bold}jq${reset} but it's not installed.\nRun ${italic}(brew install jq)${reset}\nAborting..." >&2; exit 1; }
|
command -v jq >/dev/null 2>&1 || { echo -e "${bold}93mhandbrake_for_plex${reset} require ${bold}jq${reset} but it's not installed.\nRun ${italic}(brew install jq)${reset}\nAborting..." >&2; exit 1; }
|
||||||
|
|
||||||
fzf_bin=0
|
fzf_bin=0
|
||||||
@@ -95,6 +150,7 @@ installation() {
|
|||||||
else
|
else
|
||||||
echo -e "${red}This folder does not exist !${reset}"
|
echo -e "${red}This folder does not exist !${reset}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notification() {
|
notification() {
|
||||||
@@ -142,41 +198,6 @@ done
|
|||||||
shift $((OPTIND-1))
|
shift $((OPTIND-1))
|
||||||
|
|
||||||
|
|
||||||
# https://stackoverflow.com/questions/59895/how-can-i-get-the-directory-where-a-bash-script-is-located-from-within-the-scrip
|
|
||||||
#DIR=$(realpath "$(dirname "${BASH_SOURCE[0]}")")
|
|
||||||
#SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
|
|
||||||
#DIR_SCRIPT=$(dirname -- "$( readlink -f -- "$0"; )")
|
|
||||||
|
|
||||||
####
|
|
||||||
# Configuration
|
|
||||||
|
|
||||||
# Source video folder
|
|
||||||
[[ "$input_path" == "" ]] && SRC="$HOME/Downloads" || SRC="$input_path"
|
|
||||||
|
|
||||||
# Destination video folder
|
|
||||||
[[ "$output_path" == "" ]] && DEST="$HOME/Movies" || DEST="$output_path"
|
|
||||||
|
|
||||||
# Extension video file
|
|
||||||
DEST_EXT=mp4
|
|
||||||
|
|
||||||
# Handbrake preset
|
|
||||||
[[ "$profile" == "" ]] && PRESET="Apple 720p30 Surround" || PRESET="$profile"
|
|
||||||
|
|
||||||
# Only files larger than $MAXSIZE will be processed (> 30Mo)
|
|
||||||
MAXSIZE=30000000
|
|
||||||
#MAXSIZE=300
|
|
||||||
|
|
||||||
# Open converted video file in an application
|
|
||||||
APP="Subler"
|
|
||||||
|
|
||||||
SUBTITLE_LIST="eng,fre"
|
|
||||||
|
|
||||||
# log
|
|
||||||
# this reduce handbrake verbosity
|
|
||||||
logfile=/tmp/HandBrake.log
|
|
||||||
|
|
||||||
#Move to trash after conversion
|
|
||||||
trash=true
|
|
||||||
|
|
||||||
|
|
||||||
###
|
###
|
||||||
@@ -221,8 +242,8 @@ echo -e "HandBrake Profile: ${italic}$PRESET${reset}"
|
|||||||
count=0
|
count=0
|
||||||
# Series: SxxEyy
|
# Series: SxxEyy
|
||||||
REGEX="([sS]([0-9]{2,}|[X]{2,})[eE]([0-9]{2,}|[Y]{2,}))"
|
REGEX="([sS]([0-9]{2,}|[X]{2,})[eE]([0-9]{2,}|[Y]{2,}))"
|
||||||
# Films: 2
|
# Films:
|
||||||
REGEX2="[0-9]{4}"
|
REGEX2=".[0-9]{4}" # année 2019 mais avec un caractère avant (chaine ne commence pas par 2019)
|
||||||
|
|
||||||
movies=()
|
movies=()
|
||||||
for FILE in "${SRC}"/**/*.{mkv,avi,mp4,m4v}
|
for FILE in "${SRC}"/**/*.{mkv,avi,mp4,m4v}
|
||||||
@@ -242,7 +263,6 @@ do
|
|||||||
#extension=${filename##*.}
|
#extension=${filename##*.}
|
||||||
filename=${filename%.*}
|
filename=${filename%.*}
|
||||||
|
|
||||||
|
|
||||||
: <<'END_COMMENT'
|
: <<'END_COMMENT'
|
||||||
https://stackoverflow.com/questions/41231998/mediainfo-cli-command-line-interface-syntax-teaching-me-once-for-all
|
https://stackoverflow.com/questions/41231998/mediainfo-cli-command-line-interface-syntax-teaching-me-once-for-all
|
||||||
media=$(mediainfo --Output=file:///$SCRIPT_DIR/template.txt "$FILE")
|
media=$(mediainfo --Output=file:///$SCRIPT_DIR/template.txt "$FILE")
|
||||||
@@ -251,12 +271,16 @@ do
|
|||||||
echo -e "$info\n"
|
echo -e "$info\n"
|
||||||
END_COMMENT
|
END_COMMENT
|
||||||
|
|
||||||
|
# Suprrime [ Torrent911.io ]
|
||||||
|
a="[${filename#*[}"
|
||||||
|
a="${a%]*}] "
|
||||||
|
filename=${filename#"$a"}
|
||||||
|
|
||||||
# Séries
|
# Séries
|
||||||
if [[ $filename =~ $REGEX ]]; then
|
if [[ $filename =~ $REGEX ]]; then
|
||||||
MATCH="${BASH_REMATCH[1]}"
|
MATCH="${BASH_REMATCH[1]}"
|
||||||
# Remplace les . par des espaces
|
# Remplace les . par des espaces
|
||||||
e=$(echo "${filename%$MATCH*}" | sed 's/\./\ /g' | xargs)
|
e=$(echo "${filename%$MATCH*}" | sed 's/\./\ /g' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
# Capitalise chaque mot
|
# Capitalise chaque mot
|
||||||
f=( $e )
|
f=( $e )
|
||||||
g=${f[@]^}
|
g=${f[@]^}
|
||||||
@@ -265,14 +289,20 @@ END_COMMENT
|
|||||||
# Films
|
# Films
|
||||||
elif [[ $filename =~ $REGEX2 ]]; then
|
elif [[ $filename =~ $REGEX2 ]]; then
|
||||||
MATCH2="${BASH_REMATCH[0]}"
|
MATCH2="${BASH_REMATCH[0]}"
|
||||||
e=$(echo "${filename%$MATCH2*}" | sed 's/\./\ /g' | xargs)
|
MATCH2=${MATCH2:1}
|
||||||
|
|
||||||
|
e=$(echo "${filename%$MATCH2*}" | sed 's/\./\ /g' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
new_name="$e ($MATCH2).$DEST_EXT"
|
new_name="$e ($MATCH2).$DEST_EXT"
|
||||||
else
|
else
|
||||||
echo "Could not find SXXEYY pattern"
|
echo -e "${red}\nCould not find SXXEYY or YYYY pattern${reset}"
|
||||||
new_name="$filename"
|
e=$(echo "${filename}" | sed 's/\./\ /g' | sed 's/^[[:blank:]]*//;s/[[:blank:]]*$//')
|
||||||
continue
|
read -e -p "Title: " -i "$e" e
|
||||||
|
new_name="$e.$DEST_EXT"
|
||||||
|
#echo "new_name: $new_name"
|
||||||
|
#continue
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
if ! command -v mediainfo &> /dev/null; then
|
if ! command -v mediainfo &> /dev/null; then
|
||||||
echo -e "${bold}mediainfo${reset} could not be found !\n"
|
echo -e "${bold}mediainfo${reset} could not be found !\n"
|
||||||
echo -e "You should install ${bold}mediainfo${reset}:\n"
|
echo -e "You should install ${bold}mediainfo${reset}:\n"
|
||||||
@@ -280,70 +310,187 @@ END_COMMENT
|
|||||||
echo -e ""
|
echo -e ""
|
||||||
else
|
else
|
||||||
|
|
||||||
infos=$(mediainfo "$FILE" --output=JSON | jq -s 'map({ VideoCount: .media.track[0].VideoCount, AudioCount: .media.track[0].AudioCount, TextCount: .media.track[0].TextCount, MenuCount: .media.track[0].MenuCount, FormatFichier: .media.track[0].Format, FileSize: .media.track[0].FileSize, Duration: .media.track[0].Duration, FormatVideo: .media.track[1].Format, Format_Profile: .media.track[1].Format_Profile, Format_Level: .media.track[1].Format_Level, "CodecVideo": .media.track[1].CodecID, Width: .media.track[1].Width, Height: .media.track[1].Height, FormatAudio: .media.track[2].Format, FormatAdditionalFeatures: .media.track[2].Format_AdditionalFeatures, CodecAudio: .media.track[2].CodecID, TitleAudio: .media.track[2].Title, LanguageAudio: .media.track[2].Language, DefaultAudio: .media.track[2].Default, FormatText: .media.track[3].Format, CodecText: .media.track[3].CodecID, LanguageText: .media.track[3].Language, DefaultText: .media.track[3].Default, Menu: .media.track[4].extra})')
|
#infos=$(mediainfo "$FILE" --output=JSON | jq -s 'map({ VideoCount: .media.track[0].VideoCount, AudioCount: .media.track[0].AudioCount, TextCount: .media.track[0].TextCount, MenuCount: .media.track[0].MenuCount, FormatFichier: .media.track[0].Format, FileSize: .media.track[0].FileSize, Duration: .media.track[0].Duration, FormatVideo: .media.track[1].Format, Format_Profile: .media.track[1].Format_Profile, Format_Level: .media.track[1].Format_Level, "CodecVideo": .media.track[1].CodecID, Width: .media.track[1].Width, Height: .media.track[1].Height, FormatAudio: .media.track[2].Format, FormatAdditionalFeatures: .media.track[2].Format_AdditionalFeatures, CodecAudio: .media.track[2].CodecID, TitleAudio: .media.track[2].Title, LanguageAudio: .media.track[2].Language, DefaultAudio: .media.track[2].Default, FormatText: .media.track[3].Format, CodecText: .media.track[3].CodecID, LanguageText: .media.track[3].Language, DefaultText: .media.track[3].Default, Menu: .media.track[4].extra})')
|
||||||
|
|
||||||
|
infos=$(mediainfo "$FILE" --output=JSON | jq '.media.track')
|
||||||
|
|
||||||
|
#echo "$infos" | jq
|
||||||
|
|
||||||
|
while read row
|
||||||
|
do
|
||||||
|
type=$(echo "$row" | jq -r '.["@type"]')
|
||||||
|
if [[ "$type" == "General" ]]; then
|
||||||
|
general="$row"
|
||||||
|
#echo "$general" | jq
|
||||||
|
elif [[ "$type" == "Video" ]]; then
|
||||||
|
video="$row"
|
||||||
|
#echo "$video" | jq
|
||||||
|
elif [[ "$type" == "Audio" ]]; then
|
||||||
|
audio="$row"
|
||||||
|
#echo "$audio" | jq
|
||||||
|
elif [[ "$type" == "Text" ]]; then
|
||||||
|
text="$row"
|
||||||
|
echo "$text" | jq
|
||||||
|
elif [[ "$type" == "Menu" ]]; then
|
||||||
|
menu="$row"
|
||||||
|
echo "$menu" | jq
|
||||||
|
fi
|
||||||
|
done < <(echo "$infos" | jq -c '.[]')
|
||||||
|
|
||||||
# General
|
# General
|
||||||
#nb_video=$(echo "$infos" | jq -j '.[] | .VideoCount')
|
##nb_video=$(echo "$infos" | jq -j '.[] | .VideoCount')
|
||||||
nb_audio=$(echo "$infos" | jq -j '.[] | .AudioCount')
|
#nb_audio=$(echo "$infos" | jq -j '.[] | .AudioCount')
|
||||||
|
#if [[ "$nb_audio" == "null" ]]; then nb_audio=0; fi
|
||||||
|
#nb_text=$(echo "$infos" | jq -j '.[] | .TextCount')
|
||||||
|
#if [[ "$nb_text" == "null" ]]; then nb_text=0; fi
|
||||||
|
#nb_menu=$(echo "$infos" | jq -j '.[] | .MenuCount')
|
||||||
|
#if [[ "$nb_menu" == "null" ]]; then nb_menu=0; fi
|
||||||
|
#format_fichier=$(echo "$infos" | jq -j '.[] | .FormatFichier')
|
||||||
|
#filesize=$(echo "$infos" | jq -j '.[] | .FileSize' | numfmt --to=si --format "%8.2f" | xargs)
|
||||||
|
##fsize=$(numfmt --to iec --format "%8.2f" "$filesize")
|
||||||
|
#duree=$(echo "$infos" | jq -j '.[] | .Duration' | awk -F "." '{print $1}' | awk '{printf "%d:%02d:%02d", $1/3600, ($1/60)%60, $1%60}' | xargs)
|
||||||
|
|
||||||
|
nb_audio=$(echo "$general" | jq -j '.AudioCount')
|
||||||
if [[ "$nb_audio" == "null" ]]; then nb_audio=0; fi
|
if [[ "$nb_audio" == "null" ]]; then nb_audio=0; fi
|
||||||
nb_text=$(echo "$infos" | jq -j '.[] | .TextCount')
|
nb_text=$(echo "$general" | jq -j '.TextCount')
|
||||||
if [[ "$nb_text" == "null" ]]; then nb_text=0; fi
|
if [[ "$nb_text" == "null" ]]; then nb_text=0; fi
|
||||||
nb_menu=$(echo "$infos" | jq -j '.[] | .MenuCount')
|
nb_menu=$(echo "$general" | jq -j '.MenuCount')
|
||||||
if [[ "$nb_menu" == "null" ]]; then nb_menu=0; fi
|
if [[ "$nb_menu" == "null" ]]; then nb_menu=0; fi
|
||||||
format_fichier=$(echo "$infos" | jq -j '.[] | .FormatFichier')
|
|
||||||
filesize=$(echo "$infos" | jq -j '.[] | .FileSize' | numfmt --to=si --format "%8.2f" | xargs)
|
format_fichier=$(echo "$general" | jq -j '.Format')
|
||||||
#fsize=$(numfmt --to iec --format "%8.2f" "$filesize")
|
filesize=$(echo "$general" | jq -j '.FileSize' | numfmt --to=si --format "%8.2f" | xargs)
|
||||||
duree=$(echo "$infos" | jq -j '.[] | .Duration' | awk -F "." '{print $1}' | awk '{printf "%d:%02d:%02d", $1/3600, ($1/60)%60, $1%60}' | xargs)
|
duree=$(echo "$general" | jq -j '.Duration' | awk -F "." '{print $1}' | awk '{printf "%d:%02d:%02d", $1/3600, ($1/60)%60, $1%60}' | xargs)
|
||||||
|
|
||||||
|
#echo -e "${red}nb_audio: $nb_audio${reset}"
|
||||||
|
#echo -e "${red}nb_text: $nb_text${reset}"
|
||||||
|
#echo -e "${red}nb_menu: $nb_menu${reset}"
|
||||||
|
|
||||||
|
#echo "format_fichier: $format_fichier"
|
||||||
|
#echo "filesize: $filesize"
|
||||||
|
#echo "duree: $duree"
|
||||||
|
|
||||||
|
|
||||||
# Video
|
# Video
|
||||||
format_video=$(echo "$infos" | jq -j '.[] | .FormatVideo')
|
#format_video=$(echo "$infos" | jq -j '.[] | .FormatVideo')
|
||||||
format_profile=$(echo "$infos" | jq -j '.[] | .Format_Profile')
|
#format_profile=$(echo "$infos" | jq -j '.[] | .Format_Profile')
|
||||||
format_level=$(echo "$infos" | jq -j '.[] | .Format_Level')
|
#format_level=$(echo "$infos" | jq -j '.[] | .Format_Level')
|
||||||
codec_video=$(echo "$infos" | jq -j '.[] | .CodecVideo')
|
#codec_video=$(echo "$infos" | jq -j '.[] | .CodecVideo')
|
||||||
width=$(echo "$infos" | jq -j '.[] | .Width')
|
#width=$(echo "$infos" | jq -j '.[] | .Width')
|
||||||
height=$(echo "$infos" | jq -j '.[] | .Height')
|
#height=$(echo "$infos" | jq -j '.[] | .Height')
|
||||||
|
|
||||||
|
format_video=$(echo "$video" | jq -j '.Format | select( . != null )')
|
||||||
|
format_profile=$(echo "$video" | jq -j '.Format_Profile | select( . != null )')
|
||||||
|
format_level=$(echo "$video" | jq -j '.Format_Level | select( . != null )')
|
||||||
|
codec_video=$(echo "$video" | jq -j '.CodecID | select( . != null )')
|
||||||
|
width=$(echo "$video" | jq -j '.Width | select( . != null )')
|
||||||
|
height=$(echo "$video" | jq -j '.Height | select( . != null )')
|
||||||
|
|
||||||
|
#echo "format_video: $format_video"
|
||||||
|
#echo "format_profile: $format_profile"
|
||||||
|
#echo "format_level: $format_level"
|
||||||
|
#echo "codec_video: $codec_video"
|
||||||
|
#echo "width: $width"
|
||||||
|
#echo "height: $height"
|
||||||
|
|
||||||
# Audio
|
# Audio
|
||||||
format_audio=$(echo "$infos" | jq -j '.[] | .FormatAudio')
|
#format_audio=$(echo "$infos" | jq -j '.[] | .FormatAudio')
|
||||||
format_addition=$(echo "$infos" | jq -j '.[] | .FormatAdditionalFeatures')
|
#format_addition=$(echo "$infos" | jq -j '.[] | .FormatAdditionalFeatures')
|
||||||
if [[ "$format_addition" == "null" ]]; then format_addition=""; fi
|
#if [[ "$format_addition" == "null" ]]; then format_addition=""; fi
|
||||||
codec_audio=$(echo "$infos" | jq -j '.[] | .CodecAudio')
|
#codec_audio=$(echo "$infos" | jq -j '.[] | .CodecAudio')
|
||||||
title_audio=$(echo "$infos" | jq -j '.[] | .TitleAudio')
|
#title_audio=$(echo "$infos" | jq -j '.[] | .TitleAudio')
|
||||||
language_audio=$(echo "$infos" | jq -j '.[] | .LanguageAudio')
|
#language_audio=$(echo "$infos" | jq -j '.[] | .LanguageAudio')
|
||||||
if [[ "$language_audio" == "null" ]]; then language_audio=""; fi
|
#if [[ "$language_audio" == "null" ]]; then language_audio=""; fi
|
||||||
default_audio=$(echo "$infos" | jq -j '.[] | .DefaultAudio')
|
#default_audio=$(echo "$infos" | jq -j '.[] | .DefaultAudio')
|
||||||
if [[ "$default_audio" == "null" ]]; then default_audio=""; fi
|
#if [[ "$default_audio" == "null" ]]; then default_audio=""; fi
|
||||||
|
|
||||||
|
format_audio=$(echo "$audio" | jq -j '.Format | select( . != null )')
|
||||||
|
format_addition=$(echo "$audio" | jq -j '.Format_AdditionalFeatures | select( . != null )')
|
||||||
|
#if [[ "$format_addition" == "null" ]]; then format_addition=""; fi
|
||||||
|
codec_audio=$(echo "$audio" | jq -j '.CodecID | select( . != null )')
|
||||||
|
title_audio=$(echo "$audio" | jq -j '.Title | select( . != null )')
|
||||||
|
language_audio=$(echo "$audio" | jq -j '.Language | select( . != null )')
|
||||||
|
#if [[ "$language_audio" == "null" ]]; then language_audio=""; fi
|
||||||
|
default_audio=$(echo "$audio" | jq -j '.Default | select( . != null )')
|
||||||
|
#if [[ "$default_audio" == "null" ]]; then default_audio=""; fi
|
||||||
|
|
||||||
|
#echo "format_audio: $format_audio"
|
||||||
|
#echo "format_addition: $format_addition"
|
||||||
|
#echo "codec_audio: $codec_audio"
|
||||||
|
#echo "title_audio: $title_audio"
|
||||||
|
#echo "language_audio: $language_audio"
|
||||||
|
#echo "default_audio: $default_audio"
|
||||||
|
|
||||||
# Text
|
# Text
|
||||||
format_text=$(echo "$infos" | jq -j '.[] | .FormatText')
|
#format_text=$(echo "$infos" | jq -j '.[] | .FormatText')
|
||||||
codec_text=$(echo "$infos" | jq -j '.[] | .CodecText')
|
#codec_text=$(echo "$infos" | jq -j '.[] | .CodecText')
|
||||||
language_text=$(echo "$infos" | jq -j '.[] | .LanguageText')
|
#language_text=$(echo "$infos" | jq -j '.[] | .LanguageText')
|
||||||
default_text=$(echo "$infos" | jq -j '.[] | .DefaultText')
|
#default_text=$(echo "$infos" | jq -j '.[] | .DefaultText')
|
||||||
|
|
||||||
|
format_text=$(echo "$text" | jq -j '.FormatText | select( . != null )')
|
||||||
|
codec_text=$(echo "$text" | jq -j '.CodecText | select( . != null )')
|
||||||
|
language_text=$(echo "$text" | jq -j '.LanguageText | select( . != null )')
|
||||||
|
default_text=$(echo "$text" | jq -j '.DefaultText | select( . != null )')
|
||||||
|
|
||||||
|
if [ "$nb_text" -ge 1 ]; then
|
||||||
|
echo "format_text: $format_text"
|
||||||
|
echo "codec_text: $codec_text"
|
||||||
|
echo "language_text: $language_text"
|
||||||
|
echo "default_text: $default_text"
|
||||||
|
fi
|
||||||
|
|
||||||
# Menu
|
# Menu
|
||||||
menu=$(echo "$infos" | jq -j '.[] | .Menu' | sed '1d;$d')
|
|
||||||
|
#menu=$(echo "$infos" | jq -j '.[] | .Menu' | sed '1d;$d')
|
||||||
|
menus=$(echo "$menu" | jq -j '.extra' | sed '1d;$d')
|
||||||
|
#echo "menus: $menus"
|
||||||
|
|
||||||
m=()
|
m=()
|
||||||
|
n=1
|
||||||
while IFS= read -r line
|
while IFS= read -r line
|
||||||
do
|
do
|
||||||
|
# L'apparition
|
||||||
|
# "_00_07_57_920": "en:00:07:57.920",
|
||||||
|
|
||||||
|
# Kandahar
|
||||||
|
# "_00_00_00_000": "1. Studio Logo",
|
||||||
|
|
||||||
|
REGEX1="^_(0[0-9]|1[0-9]|2[0-3])_([0-5][0-9])_([0-5][0-9])_([0-9][0-9][0-9])$"
|
||||||
|
|
||||||
|
if [[ ${line:3:13} =~ $REGEX1 ]]; then
|
||||||
|
|
||||||
t=$(echo "$line" | awk -F": " '{print $1}')
|
t=$(echo "$line" | awk -F": " '{print $1}')
|
||||||
c=$(echo "$line" | awk -F": " '{print $2}')
|
c=$(echo "$line" | awk -F": " '{print $2}')
|
||||||
|
#echo "t: $t"
|
||||||
|
#echo "c: $c"
|
||||||
|
# L'apparition
|
||||||
|
# t: "_00_07_57_920"
|
||||||
|
# c: "en:00:07:57.920",
|
||||||
|
|
||||||
|
|
||||||
tt=$(echo "$t" | sed -n '1 s/"//gp' | xargs | sed 's/^_//' | sed 's/_/h/1' | sed 's/_/mm/1' | sed 's/_/s/1' | sed 's/s.*//')
|
tt=$(echo "$t" | sed -n '1 s/"//gp' | xargs | sed 's/^_//' | sed 's/_/h/1' | sed 's/_/mm/1' | sed 's/_/s/1' | sed 's/s.*//')
|
||||||
#cc=$(echo "$c" | tr -d '"' | xargs | awk -F ":" '{print $2}' | sed 's/,$//' | sed 's/^/ /')
|
#cc=$(echo "$c" | tr -d '"' | xargs | awk -F ":" '{print $2}' | sed 's/,$//' | sed 's/^/ /')
|
||||||
cc=$(echo "$c" | tr -d '"' | xargs | sed 's/,$//' | sed 's/^/ /')
|
cc=$(echo "$c" | tr -d '"' | xargs | sed 's/,$//' | sed 's/^/ /' | xargs)
|
||||||
|
#echo "tt: $tt"
|
||||||
|
#echo "cc: $cc"
|
||||||
|
# L'apparition
|
||||||
|
# tt: 00h07mm57
|
||||||
|
# cc: en:00:07:57.920
|
||||||
|
|
||||||
m+=("$cc : $tt")
|
#m+=("$n:$tt")
|
||||||
done <<< "$menu"
|
m+=("$n:$cc ($tt)")
|
||||||
|
((n=n+1))
|
||||||
|
fi
|
||||||
|
done <<< "$menus"
|
||||||
|
|
||||||
echo -e "\n\n${bold}(${red}$(( count + 1 ))${reset}${bold} / $nb_movies) - $filename${reset}"
|
echo -e "\n\n${bold}(${red}$(( count + 1 ))${reset}${bold} / $nb_movies) $filename${reset}"
|
||||||
|
|
||||||
echo -e "\n${bold}General:${reset}"
|
echo -e "\n${bold}General:${reset}"
|
||||||
printf " %-20s %-35s \n" "Format de fichier:" "${format_fichier}"
|
printf " %-20s %-35s \n" "Format de fichier:" "${format_fichier}"
|
||||||
printf " %-20s %-35s \n" "Taille de fichier:" "${filesize}"
|
printf " %-20s %-35s \n" "Taille de fichier:" "${filesize}"
|
||||||
printf " %-21s %-35s \n" "Duree:" "${duree}"
|
printf " %-20s %-35s \n" "Duree:" "${duree}"
|
||||||
|
|
||||||
echo -e "\n${bold}Video:${reset}"
|
echo -e "\n${bold}Video:${reset}"
|
||||||
printf " %-21s %-35s \n" "Format video:" "${format_video}"
|
printf " %-20s %-35s \n" "Format video:" "${format_video}"
|
||||||
printf " %-20s %-35s \n" "Profile:" "${format_profile}"
|
printf " %-20s %-35s \n" "Profile:" "${format_profile}"
|
||||||
printf " %-20s %-35s \n" "Level:" "${format_level}"
|
printf " %-20s %-35s \n" "Level:" "${format_level}"
|
||||||
printf " %-20s %-35s \n" "Codec:" "${codec_video}"
|
printf " %-20s %-35s \n" "Codec:" "${codec_video}"
|
||||||
@@ -369,6 +516,9 @@ END_COMMENT
|
|||||||
echo -e "\n${bold}Menu:${reset}"
|
echo -e "\n${bold}Menu:${reset}"
|
||||||
for elem in "${m[@]}";
|
for elem in "${m[@]}";
|
||||||
do
|
do
|
||||||
|
#echo "${elem}"
|
||||||
|
# en:00:07:57.920 : 00h07mm57
|
||||||
|
|
||||||
c=$(echo "${elem}" | awk -F":" '{print $1}')
|
c=$(echo "${elem}" | awk -F":" '{print $1}')
|
||||||
t=$(echo "${elem}" | awk -F":" '{print $2}')
|
t=$(echo "${elem}" | awk -F":" '{print $2}')
|
||||||
printf " %-20s %-35s \n" "$c:" "${t}"
|
printf " %-20s %-35s \n" "$c:" "${t}"
|
||||||
@@ -386,15 +536,16 @@ END_COMMENT
|
|||||||
|
|
||||||
if [ "$nb_text" -ge 1 ] && [[ $SUBTITLE_LIST =~ ${language_text} ]]; then
|
if [ "$nb_text" -ge 1 ] && [[ $SUBTITLE_LIST =~ ${language_text} ]]; then
|
||||||
echo -e "$z (with ${bold}${language_text}${reset} subtitle track)"
|
echo -e "$z (with ${bold}${language_text}${reset} subtitle track)"
|
||||||
$HANDBRAKE_CLI -i "$FILE" -o "$file_export" "$PRESET" --subtitle-lang-list "$SUBTITLE_LIST" --all-subtitles 2> $logfile
|
$HANDBRAKE_CLI -i "$FILE" -o "$file_export" "$PRESET" --subtitle-lang-list "$SUBTITLE_LIST" --all-subtitles 2>> $logfile
|
||||||
else
|
else
|
||||||
echo -e "$z"
|
echo -e "$z"
|
||||||
$HANDBRAKE_CLI -i "$FILE" -o "$file_export" "$PRESET" 2> $logfile
|
$HANDBRAKE_CLI -i "$FILE" -o "$file_export" "$PRESET" 2>> $logfile
|
||||||
fi
|
fi
|
||||||
echo
|
echo
|
||||||
|
|
||||||
result=$?
|
result=$?
|
||||||
if [ "$result" = 0 ]; then
|
if [ "$result" = 0 ]; then
|
||||||
|
echo -e "${red}$new_name available in $DEST${reset}"
|
||||||
notification "HandBrake for Plex" "$new_name available in $DEST" $result
|
notification "HandBrake for Plex" "$new_name available in $DEST" $result
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user