Duplication of paths and images in the DB

Ask for help and post your question on how to use XnView MP.

Moderators: helmut, XnTriq, xnview

Post Reply
PhilEvans
Posts: 10
Joined: Wed Aug 03, 2016 7:40 pm

Duplication of paths and images in the DB

Post by PhilEvans »

When selecting photos using the Category filter, I noticed some photos appear a number of times.

On exploring the XnView.db file with sqlite3, I noticed that there seems to be mass duplication of paths; specifically entries that start '@' which appear to be my top-level photos directory, and also full paths. e.g. if I say, "SELECT * from FOLDERS" I may see both:

/my/top/dir/photos/2017/January
@photos/2017/January

They have unique folderIDs. If I search the images table I find the images are also duplicated, i.e. they appear (with different ImageID) with both of the above folders' FolderID values set.

Obviously, this makes selecting images by category difficult because a lot of images appear multiple times. It's also going to increase the size and overheads of the database.

Why are there both entries, and which one is the 'preferred' one? I wrote a Perl script to go through the database and remove duplicates (while, I think/hope, not losing any Tags assigned to the images), but obviously I don't know whether the entry I should be keeping is the '@' entry, or the full entry.


Can you advise, and/or fix the code such that it does not store duplicates. I had hoped that clicking the button to optimise the DB would succesfully remove duplicates while also ensuring that the entries in the 'TagsTree' table would make sure that any tags on the removed duplicate were first assigned to the image that was kept (if not already set), but this appeared not to be the case.

Thanks.
User avatar
xnview
Author of XnView
Posts: 46236
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Duplication of paths and images in the DB

Post by xnview »

you have changed the 'base path' setting, so some are with full pathname, and some with relative pathname.
Pierre.
Post Reply