Last active
July 31, 2021 20:21
-
-
Save projectivemotion/599219fe885ab9e05819c44570058917 to your computer and use it in GitHub Desktop.
Print Shotwell Photo Filenames by Tag
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/env bash | |
# | |
# Author: Amado Martinez - AmadoMartinez.mx | |
# License: MIT License | |
# Date: 2016-05-02 | |
# | |
# Example: | |
# $ ./shotwell_filenames_by_tag.sh ~/.local/share/shotwell/data/photo.db MyTag | |
# | |
if [ $# -lt 2 ] ; then | |
echo "Usage: path-to/photo.db tagName" | |
exit | |
fi | |
db="$1" | |
tag="$2" | |
function sql(){ | |
sqlite3 "$db" "$1" | |
} | |
function getPhotos(){ | |
sql "select photo_id_list from TagTable where name='$tag'" | sed 's/,/\n/g' | sed 's/^thumb//' | |
} | |
# Leaving room for improvement ;) | |
for hexid in `getPhotos` ; do | |
decid=$((0x${hexid})) | |
sql "select filename from PhotoTable where id=$decid" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you for posting this! This is exactly what I was looking for. You saved me a bunch of time (and I wasn't familiar with$((0x$ {hexid})) before).