Re: [Shotwell] How to delete a photo from the shotwell databse

2018-04-09 Thread Larry Bradley
My program doesn't do a lot more than recent versions of Shotwell do.
It is just a bit more convenient  for adding tags and titles.
The user sees the photo, and there is a window where he can add tags
(it is actually a drop-down list with predefined tags for my purposes)
and a window where he can enter a description.
The tags get added to the Shotwell tag table, and the description is
used as the title.
However, there is also a SQLITE3 virtual table, containing the photoid,
the description, and the tags. The SQLITE full-text search facility
allows you to do sophisticated searches , for example find all the
photos  with the words "Larry " OR "Diane" AND NOT "Fred". It also
allows proximity searches.
Since the description field gets stored in the phototable as the title,
Shotwell can also perform full-text search (which works very well - I
like the incremental search) but it is limited to an AND operation -
find the photos whose title contains ALL the words.
I think it would be easy (!) in Shotwell to make the windows for
editing tags and titles larger, which would be much more convenient.
The use of a virtual table that contains the title and the tags would
allow a more sophisticated search facility:
Look for grandchildren (a tag) and "Harry OR Sally" to find all the
photos with the tag "grandchildrer" with either Harry or Sally in the
title.
On Mon, 2018-04-09 at 09:18 +0200, Jens Georg wrote:
> > 
> > Do you plan to remove the list of tags, and have one entry per tag?
> Yes, something like that. Make proper normalized tables etc.
> 
> > 
> > 
> > The problem for my app was given a photo id, find all the tag table
> > entries with this "thumb id" and then remove the thumb and write
> > the
> > data back, rather than just finding all the records with the thumb
> > and
> > deleting them.
> > 
> > I realize that not many people are going to want to process the
> > data
> > outside of Shotwell, but having a good description of the various
> > tables and their relationships would be useful.
> There is a little bit of information available here:
> 
> https://wiki.gnome.org/Apps/Shotwell/Architecture/Database
> 
> > 
> > 
> > Many years ago I wrote a program to catalog photos (this was before
> > I
> > heard about Shotwell. It used a database system with full-text
> > search
> > abilities.
> > When I switched to Shotwell, I rewrote the program in Python, and
> > added a virtual table to the Shotwell database to make Boolean
> > searching easy. This I can use all the of the SQLITE3 full-text
> > search
> > capabilities to find photos.
> Would you care to explain a bit deeper what you are doing there?___
shotwell-list mailing list
shotwell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/shotwell-list


Re: [Shotwell] How to delete a photo from the shotwell databse

2018-04-09 Thread Jens Georg



Do you plan to remove the list of tags, and have one entry per tag?


Yes, something like that. Make proper normalized tables etc.



The problem for my app was given a photo id, find all the tag table
entries with this "thumb id" and then remove the thumb and write the
data back, rather than just finding all the records with the thumb and
deleting them.

I realize that not many people are going to want to process the data
outside of Shotwell, but having a good description of the various
tables and their relationships would be useful.


There is a little bit of information available here:

https://wiki.gnome.org/Apps/Shotwell/Architecture/Database



Many years ago I wrote a program to catalog photos (this was before I
heard about Shotwell. It used a database system with full-text search
abilities.
When I switched to Shotwell, I rewrote the program in Python, and
added a virtual table to the Shotwell database to make Boolean
searching easy. This I can use all the of the SQLITE3 full-text search
capabilities to find photos.


Would you care to explain a bit deeper what you are doing there?
___
shotwell-list mailing list
shotwell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/shotwell-list


Re: [Shotwell] How to delete a photo from the shotwell databse

2018-04-03 Thread Larry Bradley
Do you plan to remove the list of tags, and have one entry per tag?
The problem for my app was given a photo id, find all the tag table
entries with this "thumb id" and then remove the thumb and write the
data back, rather than just finding all the records with the thumb and
deleting them.
I realize that not many people are going to want to process the data
outside of Shotwell, but having a good description of the various
tables and their relationships would be useful.
Many years ago I wrote a program to catalog photos (this was before I
heard about Shotwell. It used a database system with full-text search
abilities.
When I switched to Shotwell, I rewrote the program in Python, and added
a virtual table to the Shotwell database to make Boolean searching
easy. This I can use all the of the SQLITE3 full-text search
capabilities to find photos.
I do all my photo editing in Shotwell, but use my program to organize
them (adding titles, tags, etc). To delete photos, I used to just add a
tag 'deleteme' then went into Shotwell and deleted all the photos with
that tag. But then I decided to try to do the delete in my program, and
thus the question I posted. I THINK I have it all working now.
On Tue, 2018-04-03 at 10:13 +0200, Jens Georg wrote:
> Hi,
> 
> The tombstonetable is for images that got deleted from disk without 
> Shotwell
> 
> Also please note that I plan to clean-up the database scheme this 
> unstable cycle,
> getting rid of those generated ids, the odd tag handling and to
> properly 
> add
> geolocation information.
> 
> > 
> > ___
> > shotwell-list mailing list
> > shotwell-list@gnome.org
> > https://mail.gnome.org/mailman/listinfo/shotwell-list___
shotwell-list mailing list
shotwell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/shotwell-list


Re: [Shotwell] How to delete a photo from the shotwell databse

2018-04-03 Thread Jens Georg

Hi,

The tombstonetable is for images that got deleted from disk without 
Shotwell


Also please note that I plan to clean-up the database scheme this 
unstable cycle,
getting rid of those generated ids, the odd tag handling and to properly 
add

geolocation information.



On 03/04/18 01:24, Larry Bradley wrote:

However, there are other tables that refer to photos (eventtable,


Eventtable is referenced from phototable: Eventtable.id <=> 
Phototable.event_id.


tagtable) that will need to be updated. Can someone tell me how 
Shotwell

deletes entries in these tables?


Tagtable.photo_id_list contains a list of images associated with that
tag. For photos they look like this: thumb0cc1 – i.e.
"thumb" + the hex representation of the photo id. Or in printf-terms:
("thumb%016x", phototable.id).

For videos it is the same (IIRC), though with "video-" instead of
"thumb" and from the videotable.id.


For example, the tag table. Given the photo id, I know the thumbnail
name. The problem is to find that name (eg thumb0007f) in the tag
table's photo_id_list. Also, I need to find the photoid in the list as
well, to delete the Folders entry.

Any help on deleting entries from the various shotwell tables, given a 
photo id, would be appreciated

Thanks


Other things... just noting from looking at the database:
 - There is a link phototable.id <=> eventtable.primary_source_id as
well. I guess it either sets the date of the event and/or thumbnail.
 - Reference from backingphototable: backingphototable.id <=>
phototable.editable_id.

There is a tombstonetable which I cannot quite figure out does or how
it is referenced

The saved search table I have not looked at so much... but also seems
simple, though not needed for your application, I guess.

Hope that helps.

~Jørn


___
shotwell-list mailing list
shotwell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/shotwell-list

___
shotwell-list mailing list
shotwell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/shotwell-list


Re: [Shotwell] How to delete a photo from the shotwell databse

2018-04-02 Thread Jørn Villesen Christensen

Hi,


On 03/04/18 01:24, Larry Bradley wrote:

However, there are other tables that refer to photos (eventtable,


Eventtable is referenced from phototable: Eventtable.id <=> 
Phototable.event_id.



tagtable) that will need to be updated. Can someone tell me how Shotwell
deletes entries in these tables?


Tagtable.photo_id_list contains a list of images associated with that 
tag. For photos they look like this: thumb0cc1 – i.e. 
"thumb" + the hex representation of the photo id. Or in printf-terms: 
("thumb%016x", phototable.id).


For videos it is the same (IIRC), though with "video-" instead of 
"thumb" and from the videotable.id.



For example, the tag table. Given the photo id, I know the thumbnail
name. The problem is to find that name (eg thumb0007f) in the tag
table's photo_id_list. Also, I need to find the photoid in the list as
well, to delete the Folders entry.

Any help on deleting entries from the various shotwell tables, given a photo 
id, would be appreciated
Thanks


Other things... just noting from looking at the database:
 - There is a link phototable.id <=> eventtable.primary_source_id as 
well. I guess it either sets the date of the event and/or thumbnail.
 - Reference from backingphototable: backingphototable.id <=> 
phototable.editable_id.


There is a tombstonetable which I cannot quite figure out does or how it 
is referenced


The saved search table I have not looked at so much... but also seems 
simple, though not needed for your application, I guess.


Hope that helps.

~Jørn


___
shotwell-list mailing list
shotwell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/shotwell-list


[Shotwell] How to delete a photo from the shotwell databse

2018-04-02 Thread Larry Bradley
I'm playing around with a Python GTK program to work with my Shotwell
data.
Works fine. I can display images, search for tags, etc, make changes to

things - all works well.

I've added the ability to delete images - I can delete the record from
the phototable, as well as the photo and the thumbnail.

However, there are other tables that refer to photos (eventtable,
tagtable) that will need to be updated. Can someone tell me how
Shotwell
deletes entries in these tables?

For example, the tag table. Given the photo id, I know the thumbnail
name. The problem is to find that name (eg thumb0007f) in the tag
table's photo_id_list. Also, I need to find the photoid in the list as
well, to delete the Folders entry.
Any help on deleting entries from the various shotwell tables, given a photo 
id, would be appreciated
Thanks



-- 
Larry Bradley  
Orleans (Ottawa) Canada___
shotwell-list mailing list
shotwell-list@gnome.org
https://mail.gnome.org/mailman/listinfo/shotwell-list