Patch review : 321770 - Auto Tag imported photos with special tag



Brief check of patch for 321770
===============================

Check for ==> for things to modify.

==> Patch do not apply cleanly to CVS
Easy to manually fix though. 
(Observe "Catalog.GetString ("Last Import"))" instead of "Last Import".
This needs to be changed in TagStore.cs as well as in ImportCommand.cs)

I have imported a number of different batches, and it do seem to work
nicely.

==> I checked the code a bit, and see that first there is a for loop to
commit any new tag which the user have added during import. Then later
on there is the new for loop with this latest import tag commit. Would
it be possible to just have one commit per photo?
With this patch, you would always tag a photo, so the for loop should
always be executed. Moving the check from before for loop to before
setting the tag.

Am wondering if you have checked for possible slowdown due to the extra
commits?
==> Have you tested how long time it takes to import 1000 pictures or so
with
1) No patch and no tag attached during import
2) No patch and    tag attached during import
3) Patch    and no tag attached during import
4) Patch    and    tag attached during import

I do not think we need to update any old database, since the patch
automatically checks for this "Last Import" tag, and if it does not
exist creates it. Since the user might delete the tag I think this is
quite ok solution.

==> When you remove the last "Last Import" tag, before you set the new
tag, you have another for loop and commit on each photo. Wouldn't it be
possible to do something like "DELETE FROM photo_tags WHERE tag_id =
{0}" This should go much faster.

==> I also saw that you have two lookups for "GetTagByName("Last
Import");"
Is this needed? Could it not be solved with only one lookup?


In short
--------
1) Delete old Last Import tag (delete from photo_tags...)
   (or delete + update if keeping, say, 10 Import sessions)
2) Create Last Import tag
3) Loop through imported photos
  a) If user specified a tag, add it
  b) Add the Last Import tag
  c) commit

--------------------
I would really like to have the last 5-10 imports though. Not to sure
how this should be implemented.
Perhaps a tag hierarchy like this
Last Imports
  --> 0
  --> 1
  --> 2
  --> 9
But this would demand the following SQL statements (or something like
this showing 5 last imports here)
DELETE FROM photo_tags WHERE tag_id = <9>
UPDATE photo_tags tag_id=5 WHERE tag_id = 4
UPDATE photo_tags tag_id=4 WHERE tag_id = 3
UPDATE photo_tags tag_id=3 WHERE tag_id = 2
UPDATE photo_tags tag_id=2 WHERE tag_id = 1
UPDATE photo_tags tag_id=1 WHERE tag_id = 0
(automatically create the new tag if it did not exist already)
How much longer time would this take?





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