Re: Finding mislaid tags



Dougie Nisbet wrote:
> I'm usually pretty good at keeping my tag hierarchy neat and tidy.
> However sometimes I forget where I've put one or accidentally get it in
> the wrong place. For example, I've lost 'Merseyside'. It's not under my
> 'Places' tag so I've probably accidentally buried it in another tag
> tree. I can
> 
>    /Merseyside
> 
> and find all the photos. I just can't find the tag.

While the interface does not offer a search option you can make use of
the fact that f-spot uses an sqlite database. Those can be queried by
the sqlite command line tool. Use something like this to get a list of
all your tags and their parent tags:

sqlite3 .config/f-spot/photos.db "select label.name,
parents.name,label.is_category from tags as label,tags as parents where
parents.id=label.category_id union select
tags.name,'ROOT',tags.is_category from tags where
tags.category_id=0"|sort|less

(one line of course, and this assumes that your f-spot database lives in
 ~/.config/f-spot/photos.db, and that your sqlite command line tool goes
by the name sqlite3 as it does on Debian and derived distros.)

This produces a list of tags like the following:

...
...
Autumn|Seasons|1
Bellini|Paard|1
Birthday_Hanna|Events|1
Borreliosis|Diseases|1
Buildings|Objects|1
CanonIXUS70-Rob|Sources|1
CanonPSA460-Frank|Sources|1
CanonPSA530-Wil|Sources|1
CanonPSG9-Teodor|Sources|1
Clarissa|People|1
Clouds, skies and meteorological phenomenae|Objects|1
Coco|Paard|1
Objects|ROOT|1
Hidden|ROOT|0
...
...


Use grep to find your tag:

sqlite3 .config/f-spot/photos.db "select label.name,
parents.name,label.is_category from tags as label,tags as parents where
parents.id=label.category_id union select
tags.name,'ROOT',tags.is_category from tags where tags.category_id=0"|
grep Merseyside

(one line, again)

If 'Merseyside' shows up as

Merseyside|ROOT|1

it should be visible somewhere as a direct branch of the root. If it
shows up with another tag name as parent you can follow the trail back
to the root. If it shows up with a '0' at the last position:

Merseyside|ROOT|0

something is wrong - it is marked as not being a category.

You can use the database for all sorts of handy things. I use it to
create websites based on tag names in combination with a command line
version of jalbum. To add or remove items from the site I only need to
add or remove tags in f-spot. This could be made into an extension but
it currently runs as a simple bash script.

Cheers//Frank


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]