{"id":42,"date":"2009-10-02T23:03:50","date_gmt":"2009-10-03T04:03:50","guid":{"rendered":"http:\/\/ebixio.com\/wordpress\/?p=42"},"modified":"2009-10-02T23:03:50","modified_gmt":"2009-10-03T04:03:50","slug":"inspect-the-f-stop-photo-db-file","status":"publish","type":"post","link":"http:\/\/ebixio.com\/blog\/2009\/10\/02\/inspect-the-f-stop-photo-db-file\/","title":{"rendered":"Inspect the f-stop photo.db file"},"content":{"rendered":"<p>At one point I had a need to extract various pieces of information from the <a href=\"http:\/\/f-spot.org\">f-spot<\/a> <code lang=\"bash\">photo.db<\/code> file (that&#8217;s where f-spot keeps all the information), so I wrote this script. Posting it here in case others find it useful. I called it<\/p>\n<p><a href=\"http:\/\/ebixio.com\/wordpress\/wp-content\/uploads\/2009\/10\/f-spot-list\"><\/a><\/p>\n<blockquote><p><a href=\"http:\/\/ebixio.com\/wordpress\/wp-content\/uploads\/2009\/10\/f-spot-list\">f-spot-list<\/a><\/p><\/blockquote>\n\n\n<pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n\n#!\/bin\/bash\n\n# Author: Gabriel Burca (gburca dash fspotlist at ebixio dot com)\n# Version: 1.0\n#\n# Copyright (C) 2006-2009  Gabriel Burca (gburca dash fspotlist at ebixio dot com)\n#\n# This program is free software; you can redistribute it and\/or\n# modify it under the terms of the GNU General Public License\n# as published by the Free Software Foundation; either version 2\n# of the License, or (at your option) any later version.\n#\n# This program is distributed in the hope that it will be useful,\n# but WITHOUT ANY WARRANTY; without even the implied warranty of\n# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n# GNU General Public License for more details.\n#\n# You should have received a copy of the GNU General Public License\n# along with this program; if not, write to the Free Software\n# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n\nset -o nounset\nset -o errexit\n\nfunction usage () {\n    cat &lt;&lt; EOF\nExtracts various pieces of information from an f-spot photo.db file.\nUsage:\n    $0 &lt;photo.db&gt; &lt;option&gt;\n\nOptions:\n    -P | --Photo        Pictures in the Photo directory\n    -k | --links DIR... All pictures in DIR that are not links\n    -a | --all          All pictures in database\n    -h | --has TAG...   Show pictures tagged with the tag\n    -t | --tags         Show all available tags\n\n&lt;photo.db&gt; is usually &quot;~\/.config\/f-spot\/photos.db&quot;\n\nEx:\n    - Find all photos tagged &quot;Favorites&quot; or &quot;Web&quot;:\n    $0 photos.db -h Favorites Web | sort | uniq | sed 's|^file:\/\/||' \\\n        | xargs -I linkName readlink -e linkName\n\nEOF\n}\n\nfunction PhotosInPhotoDir() {\n    sqlite3 &quot;$PHOTO_DB&quot; &quot;select id, uri from photos where uri like '%Photos%';&quot;\n}\n\nfunction HasTag() {\n    for TAG in $@ ; do\n        SQL=&quot;select base_uri || filename from photos \\\n            inner join photo_tags on photos.id = photo_tags.photo_id \\\n            inner join tags on photo_tags.tag_id = tags.id \\\n            where tags.name like '$TAG';&quot;\n        #echo $SQL\n        sqlite3 &quot;$PHOTO_DB&quot; &quot;$SQL&quot;\n    done\n}\n\nfunction ShowNonLinks() {\n        for DIR in $@ ; do\n                find &quot;$DIR&quot; -type f\n        done\n}\n\nfunction ShowTags() {\n    sqlite3 &quot;$PHOTO_DB&quot; &quot;select name from tags order by name;&quot;\n}\n\nfunction ShowAll() {\n    sqlite3 &quot;$PHOTO_DB&quot; &quot;select * from photos;&quot;\n}\n\n################################################################################\n# main()\n################################################################################\n\nif &#x5B; $# -lt 2 ]; then\n    usage\n    exit 1\nfi\n\nIFS_orig=$IFS\nIFS='\n'\n\nPHOTO_DB=$1\nshift\n\nif &#x5B; ! -e &quot;$PHOTO_DB&quot; ]; then\n    usage\n    exit 2\nfi\n\ncase $1 in\n    -P | --Photo)\n        shift\n        PhotosInPhotoDir $@\n        ;;\n    -k | --links)\n        shift\n        ShowNonLinks $@\n        ;;\n    -t | --tags)\n        shift\n        ShowTags $@\n        ;;\n    -h | --has)\n        shift\n        HasTag $@\n        ;;\n    -a | --all)\n        shift\n        ShowAll $@\n        ;;\n    *)\n        usage\n        exit 1\n        ;;\nesac\n\nIFS=$IFS_orig\n<\/pre>","protected":false},"excerpt":{"rendered":"<p>At one point I had a need to extract various pieces of information from the f-spot photo.db file (that&#8217;s where f-spot keeps all the information), so I wrote this script. Posting it here in case others find it useful. I called it f-spot-list #!\/bin\/bash # Author: Gabriel Burca (gburca dash fspotlist at ebixio dot com) [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[5,12,18,19,17],"class_list":["post-42","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-bash","tag-linux","tag-photo","tag-pictures","tag-script"],"_links":{"self":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/posts\/42","targetHints":{"allow":["GET"]}}],"collection":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/comments?post=42"}],"version-history":[{"count":0,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/posts\/42\/revisions"}],"wp:attachment":[{"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/media?parent=42"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/categories?post=42"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ebixio.com\/blog\/wp-json\/wp\/v2\/tags?post=42"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}