suppression de vidéos

This commit is contained in:
Gabriel Radureau
2025-10-21 18:52:39 +02:00
parent fbe3c01de7
commit 225a1911c8
4 changed files with 74 additions and 3 deletions

34
program2/check.sh Executable file
View File

@@ -0,0 +1,34 @@
#!/bin/bash
set -euo pipefail
DANCE_VIDEOS_DB="${HOME}/Documents/.DanceVideos/db.sqlite"
RAW_VIDEOS_DIR="${HOME}/Documents/.DanceVideos/raw/"
check_registered_files_exist() {
sqlite3 -separator '|' "$DANCE_VIDEOS_DB" "
SELECT file_name, raw_file, mp4_file FROM videos;
" | while IFS='|' read -r file_name raw_file mp4_file; do
# Sauter l'en-tête
if [[ "$file_name" == "file_name" ]]; then
continue
fi
# Ignorer les lignes vides
if [[ ! -e "$raw_file" || ! -e "$mp4_file" ]]; then
echo "$raw_file KO : $mp4_file" >&2
else
echo "$raw_file OK"
fi
done
}
check_files_are_registered() {
for f in $(find "$RAW_VIDEOS_DIR" -maxdepth 1 -type f \( -iname "*.mp4" -o -iname "*.mov" \) -print); do
if [[ -z $(sqlite3 "$DANCE_VIDEOS_DB" "SELECT 1 FROM VIDEOS WHERE RAW_FILE='$f';") ]]; then
echo "$f not registered" >&2
# open $f
fi
done
}
check_files_are_registered