Note de ce sujet :
  • Moyenne : 0 (0 vote(s))
  • 1
  • 2
  • 3
  • 4
  • 5
nettoyage de la DB de Darktable
#2
oui y a un script qui permet de faire ca...

debut du script ---

:~$ cat scripts/purge_darktable # ne pas copier coller cette ligne
#!/bin/bash
#
# DARKTABLE DATABASE CLEANER
#
# This script removes from the database the files
# that are not located where they are supposed to be.
#
# USAGE :
# ./darktable_db_cleaner.sh
# Will use the database located in :
# ~/.config/darktable/library.db
#
# ./darktable_db_cleaner.sh /path/to/library.ext
# Will use the specified database
#
# Created by Rufus Wilson
# contact : marsou75@gmail.com
#


if [ ! "`type -t sqlite3`"=="file" ] ; then
echo "sqlite3 is required"
sudo apt-get install sqlite3
fi

if [ -f "$1" ] ; then
library="$1"
else
library="/home/"$USER"/.config/darktable/library.db"
fi

for film_roll_id in `sqlite3 -noheader -list -interactive $library "SELECT id FROM film_rolls WHERE 1 ORDER BY id ASC;"`
do
film_roll_folder="`sqlite3 -noheader -list -interactive $library "SELECT folder FROM film_rolls WHERE id=$film_roll_id ORDER BY id ASC;"`"
echo "*** "$film_roll_folder" ***"

echo "-- cleaning database"
for photo_id in `sqlite3 -noheader -list -interactive $library "SELECT id FROM images WHERE film_id=$film_roll_id ORDER BY filename ASC;"`
do
photo_filename=`sqlite3 -noheader -list -interactive $library "SELECT filename FROM images WHERE id=$photo_id ORDER BY filename ASC;"`
if [ ! -f "$film_roll_folder/$photo_filename" ] ; then
echo $photo_filename" deleted"
sqlite3 -noheader -list -interactive $library "DELETE FROM images WHERE id=$photo_id;"
fi
done
nb=`sqlite3 -noheader -list -interactive $library "SELECT count(id) FROM images WHERE film_id=$film_roll_id ORDER BY filename ASC;"`
if [ "$nb" -eq "0" ] ; then
sqlite3 -noheader -list -interactive $library "DELETE FROM film_rolls WHERE id=$film_roll_id;"
fi
echo " ->cleaned"
done

# Shrink the size of database
sqlite3 -noheader -list -interactive $library "VACUUM"
-- fin du script

copier coller de #!/bin/bash jusque avant --- fin du script dans un fichier par exemple purge_darktable et ensuite faire chmod 700 purge_darktable

et c'est bien de mettre dans un dossier $HOME/scripts/ le fichier scripts à rentrer dans PATH dans le fichier .profile ou .bashrc
uc   sedateck 8 go ram 
appareil D5100 - objectif nikkor 18-55G 1:3.5-5.6 VR
objectif samyang  AE 14mm 1:2.8
-----

ordinateur de burreau, 
1TO disque dur,   240 GO SSD
8 GO de ram
carte video  + gpu 

raspberry pi 4  2GO

darktable 4.4.2







Répondre


Messages dans ce sujet
RE: nettoyage de la DB de Darktable - par patrick L - 02-11-17, 09:07

Atteindre :


Utilisateur(s) parcourant ce sujet : 1 visiteur(s)