From 33a1733c9fdde99fdcc056033a9a50736ef050bd Mon Sep 17 00:00:00 2001 From: UNFR Date: Thu, 29 May 2025 20:20:42 +0000 Subject: [PATCH] Reecriture de la fonction sanitize MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Reecriture de la fonction sanitize afin d’éviter le bug sur les épisode contenant FiNAL --- postprocess.sh | 46 ++++++++++++++++++---------------------------- 1 file changed, 18 insertions(+), 28 deletions(-) diff --git a/postprocess.sh b/postprocess.sh index 8b32b4b..0eee6bd 100644 --- a/postprocess.sh +++ b/postprocess.sh @@ -71,98 +71,88 @@ remove_accents() { # - dernier segment préfixé par un tiret # ---------------------------------- sanitize_name() { - # Extraction du nom de base et de l'extension local filepath="$1" local filename="$(basename "$filepath")" local ext="${filename##*.}" local name="${filename%.*}" - # On veut vérifier que name ne contient PAS l’un des mots suivants local upper_name="${name^^}" - - # Si le nom est entièrement en minuscules - # OU ne contient aucun des mots-clés SUBFRENCH|TRUEFRENCH|FRENCH|MULTI|VOSTFR if [[ "$name" == "${name,,}" ]] || ! [[ "$upper_name" =~ THEATRICAL|DIRECTOR|EXTENDED|REMASTERED|UNRATED|UNCENSORED|DOC|PART|REPACK|PROPER|INTERNAL|FINAL|SUBFRENCH|TRUEFRENCH|FRENCH|MULTI|VOSTFR ]]; then local parent="$(basename "$(dirname "$filepath")")" name="$(remove_accents "$parent")" fi - # Translit accents name="$(remove_accents "$name")" - # Normalisation des séparateurs name="${name//[ _]/.}" - # Découpage en segments IFS='.' read -ra parts <<< "$name" local total=${#parts[@]} local keep=() - local i j k local marker_index=-1 local pattern - # --- 1) d'abord, on regarde si on a un SxxEyy quelque part --- + # Trouver SxxEyy ou année for ((i=0; i= 0 )); then - # on garde tout jusqu'au marqueur inclus keep=("${parts[@]:0:marker_index+1}") - # on cherche ensuite le premier tag qualité/langue + + # Premier tag genre FINAL/PROPER/INTERNAL, etc. for ((j=marker_index+1; j