From 465dc7c8e4f28b055cd100f21dc9c077049af698 Mon Sep 17 00:00:00 2001 From: Thorsten Date: Mon, 27 Jan 2025 18:58:43 +0100 Subject: [PATCH] debug verbessert --- bin/auto_sort.sh | 43 ++++++++++++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 5 deletions(-) diff --git a/bin/auto_sort.sh b/bin/auto_sort.sh index bf908ce..0ff2ffa 100755 --- a/bin/auto_sort.sh +++ b/bin/auto_sort.sh @@ -6,6 +6,19 @@ settings_file="./settings.ini" ffprobe_path="/usr/bin/ffprobe" +#colors +RED='\033[0;31m' +GREEN='\033[0;92m' +BLUE='\033[0;94m' +YELLOW='\033[0;33m' +WHITE_ON_GRAY='\033[0;37;100m' +BLACK_ON_WHITE='\033[0;30;47m' +WHITE_ON_RED='\033[0;37;41m' +YELLOW_ON_WHITE='\033[0;37;43m' +NC='\033[0m' # No Color + + + # Funktion zum Extrahieren der Sprachen und Audio-Codec für alle Audio-Spuren extract_audio_languages_and_codecs() { @@ -104,16 +117,31 @@ main(){ output_dir=$(echo "$output_dir" | sed 's|//|/|g') - echo "output_dir: '$output_dir'" + echo "────────────────────────────────────────────────────────────────" + echo -e "${BLACK_ON_WHITE} Auto Sort ${NC}" + echo "────────────────────────────────────────────────────────────────" + echo " " + echo -e "${WHITE_ON_GRAY} Input Folder ${NC} ""$input_folder""" + echo -e "${WHITE_ON_GRAY} Output Folder ${NC} ""$output_dir""" + echo " " + echo "────────────────────────────────────────────────────────────────" mkdir -p "$output_dir" # Durchlaufe alle Videodateien im Eingabeverzeichnis rekursiv find "$input_folder" -type f \( -iname "*.mp4" -o -iname "*.mkv" -o -iname "*.avi" \) | while IFS= read -r file; do + + echo "────────────────────────────────────────────────────────────────" + + # Datei relativ zu input_folder + relative_path=$(realpath --relative-to="$input_folder" "$file") + # Überspringe Dateien, die "-sample" im Dateinamen haben - if [[ "$file" == *"-sample"* ]]; then - echo "Überspringe Datei '$file' (wegen '-sample' im Dateinamen)" + if [[ "$file" == *"sample."* ]]; then + + echo -e "${YELLOW_ON_WHITE} Überspringe ${NC} ${YELLOW}$relative_path${NC}" + echo -e "${YELLOW_ON_WHITE} Grund ${NC} ${YELLOW}'sample.' im Dateinamen${NC}" continue fi @@ -125,7 +153,8 @@ main(){ # Wenn keine Audio- oder Untertitel-Spuren vorhanden sind, überspringe die Datei if [ -z "$audio_streams" ] && [ -z "$subtitle_streams" ]; then - echo "Keine Audio- oder Untertitel-Spuren in '$file'. Überspringe." + echo -e "${WHITE_ON_RED} Überspringe ${NC} ${RED}$relative_path${NC}" + echo -e "${WHITE_ON_RED} Grund ${NC} ${RED}Keine Audio- oder Untertitel-Spuren gefunden${NC}" continue fi @@ -143,9 +172,13 @@ main(){ target_folder="$output_dir/$folder_name" mkdir -p "$target_folder" + + echo -e "${WHITE_ON_GRAY} Verschiebe ${NC} $relative_path" + echo -e "${WHITE_ON_GRAY} Nach ${NC}${GREEN}$folder_name${NC}" + # Datei in den entsprechenden Ordner verschieben mv "$file" "$target_folder/" - echo "Verschiebe '$file' nach '$target_folder/'" + done }