check if TMDB / REFERENCE is a number

This commit is contained in:
qo-op 2021-03-04 21:56:36 +01:00
parent b6d02f8501
commit 9ac2c8a07b
2 changed files with 11 additions and 2 deletions

View File

@ -182,8 +182,13 @@ zenity --question --width 300 --text "IMPORTANT! Nous allons ouvrir le site them
[ $? == 1 ] && exit 1
xdg-open "https://www.themoviedb.org/search?query=${FILE_TITLE}"
TMDB=$(zenity --entry --title="Identification TMDB" --text="Indiquez le numéro de la fiche du film. Exemple: https://www.themoviedb.org/movie/301528-toy-story-4 => 301528" --entry-text="")
TMDB=$(zenity --entry --title="Identification TMDB" --text="Indiquez le numéro de la fiche du film. Exemple: 301528 (à extraire du lien https://www.themoviedb.org/movie/301528-toy-story-4)" --entry-text="")
[[ $TMDB == "" ]] && exit 1
if ! [[ "$TMDB" =~ ^[0-9]+$ ]]
then
zenity --warning --width ${large} --text "Vous devez renseigner un numéro! Merci de recommencer..." && exit 1
fi
# VIDEO TITLE
TITLE=$(zenity --entry --width 300 --title "Titre" --text "Indiquez le titre de la vidéo" --entry-text="${FILE_TITLE}")

View File

@ -72,7 +72,11 @@ case ${CAT} in
film | serie | anime)
INDEXPREFIX="TMDB_"
REFERENCE=$(echo "$path" | cut -d '/' -f 6 ) # Path contains TMDB id
[ "${REFERENCE}" -ne "${REFERENCE}" ] && echo "ERROR: $path BAD TMDB code. Get it from https://www.themoviedb.org/ " && exit 1 # ${REFERENCE} NOT A NUMBER
if ! [[ "$REFERENCE" =~ ^[0-9]+$ ]] # ${REFERENCE} NOT A NUMBER
then
echo "ERROR: $path BAD TMDB code. Get it from https://www.themoviedb.org/ "
exit 1
fi
;;
*)
echo "$CAT inconnu" && exit 1