From e809d72e658c963277bb490154019a7664c091c2 Mon Sep 17 00:00:00 2001 From: Ssyleric <47066760+Ssyleric@users.noreply.github.com> Date: Mon, 24 Mar 2025 23:42:18 +0100 Subject: [PATCH] Update watch-count_media.sh --- watch-count_media.sh | 82 +++++++++++++++++++++++++------------------- 1 file changed, 46 insertions(+), 36 deletions(-) diff --git a/watch-count_media.sh b/watch-count_media.sh index 11c8e62..ba32fe1 100644 --- a/watch-count_media.sh +++ b/watch-count_media.sh @@ -1,29 +1,28 @@ #!/bin/bash +# Fonction de navigation interactive avec fzf explorer() { local DIR="$1" while true; do - # Crée une liste : ".." pour revenir + fichiers/rep dans ce dossier - CHOICE=$(ls -Ap "$DIR" | fzf --prompt="📂 $DIR > " --header="Sélectionne un fichier .log ou un dossier" --height=40% --reverse) - - # Si échappé ou rien sélectionné + CHOICE=$(ls -Ap "$DIR" | awk '{print} END {print "../"}' | fzf \ + --prompt="📂 $DIR > " \ + --header="Sélectionne un fichier .log ou un dossier" \ + --height=40% --reverse) + [ -z "$CHOICE" ] && echo "❌ Annulé." && exit 1 - # Gestion ".." pour revenir au parent if [ "$CHOICE" == "../" ]; then DIR=$(dirname "$DIR") continue fi - FULL_PATH="$DIR/$CHOICE" + FULL_PATH="$(realpath "$DIR/$CHOICE")" - # Si dossier → replonger dedans if [ -d "$FULL_PATH" ]; then DIR="$FULL_PATH" continue fi - # Si fichier avec extension .log → ok if [[ "$FULL_PATH" =~ \.log$ ]]; then echo "✅ Fichier sélectionné : $FULL_PATH" echo "" @@ -37,42 +36,53 @@ explorer() { done } +# Fonction de comptage audio/vidéo (sans couleurs) compteur() { -LOGFILE="$1" + LOGFILE="$1" + TMP_SCRIPT="/tmp/count_media_temp.sh" -watch -n 1 " -echo '--- Compteur audio/vidéo pour : $LOGFILE ---' + cat > "$TMP_SCRIPT" <