Digikam/Gestor de la cua de lots i un script de l'intèrpret d'ordres

From KDE UserBase Wiki
Revision as of 14:56, 29 February 2012 by Abella (talk | contribs) (Created page with "Una de les característiques menys conegudes de '''digiKam''' és la capacitat de vincular els scripts a les notificacions. A primera vista, aquesta pot semblar una funcionalitat...")
Other languages:

Processar fotos amb el Gestor de la cua de lots i un script de l'intèrpret d'ordres

Transcrit des de l'article d'en Dmitri Popov, l'11 de juliol de 2011

Una de les característiques menys conegudes de digiKam és la capacitat de vincular els scripts a les notificacions. A primera vista, aquesta pot semblar una funcionalitat molt fosca, però que us pot dur a uns usos intel·ligents. Diguem que voleu mantenir un portafoli de fotos seleccionades en un dispositiu mòbil. Canviareu la mida de diverses fotos a una mida determinada per a que sigui més fàcil veure-les en el dispositiu mòbil i el transferir-les des de digiKam cap al dispositiu mòbil de forma manual no és molt pràctic. I aquí és on l'habilitat d'activar scripts a través de les notificacions pot ser molt útil. Podeu afegir un senzill script de Bash a la notificació de cua per lots completada, de manera que s'activarà automàticament quan l'eina Gestor de la cua de lots hagi acabat de processar les fotos.

The Bash script is very simple, indeed. It uses the rsync tool to copy the processed photos from the source directory (in this case, it’s /home/user/Photos/Processed) to the /DCIM/Camera directory on the mounted SD card:

#!/bin/bash
rsync -avz --delete /home/usuari/Fotos/Processades /media/0CFA-5602/DCIM/Camera

Paste the code above into an empty text file and save it as a postprocess.sh file (don’t forget to replace the example paths with the actual paths to the source and destination directories). Make then the script executable using the chmod o+x postprocess.sh command.



In digiKam, choose Settings -> Configure Notifications and select the Batch queue completed item. Tick the Run command check box, and enter the path to the postprocess.sh script in the appropriate field. As you might have guessed, this links the script to the notification, so the script is triggered as soon as the batch operation is finished.

Next, create a tag (e.g.,transfer) in digiKam and assign it to the photos you want to transfer to the mobile device. Alternatively, you can use a specific color label for that. Use then the Filter right sidebar to display the tagged or labelled photos, select them, and press Ctrl + B (or choose Tools -> Batch Queue Manager) to add them to a new batch queue. In the Queue Settings section, click on the Target tab and select the Photos -> Processed sub-album. Under the Base Tools tab, double-click on the Transform -> Resize tool to add it to the Assigned Tools section. In the Tool Settings pane, specify the desired length. You can choose between several presets, or enable the Use Custom Length option and specify the desired length.

Hit then the Run button, and once the batch operation is completed, the assigned Bash script copies the resized photos to the mounted SD card.

You can tweak the script to perform other post-processing actions, too. For example, if you use the llgal command-line tool to generate static HTML photo galleries, you can tweak the script to add the processed photos to an HTML album. The script may look something like this:

cd /home/usuari/Fotos/Processades
llgal --exif --li -L --sx 800 --sy 600

In other words, you can do all kinds of clever tricks by linking scripts to notifications.