Milking the database for categories

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

Moderators: helmut, XnTriq, xnview

Post Reply
jonha4711
Posts: 62
Joined: Mon Feb 08, 2016 4:35 pm

Milking the database for categories

Post by jonha4711 »

Is the following scenario viable?
This is written under the assumption that categories are part of the binary BLOB called 'Meta' in XnView.db's Images table. My photos, once in the database, tend to stay as they are as I work on copies.
1. After setting categories for my images, I access the database (with XnViewMP not running of course) via a self-written script that reads and writes all image filenames (or IDs) and the complete 'Meta' blobs to a separate file.
2. Later I have to recreate the database for whatever reason, but we can assume, for the sake of the discussion, that the image files themselves are completely unchanged and that there are no additions or deletions.
3. If then I read the 'Meta' blobs and filenames from my saved file and and write the blobs back into the newly created database, should that process recreate my categories as well?

I know this is probably a highly unsafe procedure and I will (try to) make sure that my database never gets corrupted and that I do have backups... but better safe than sorry.
User avatar
xnview
Author of XnView
Posts: 46238
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Milking the database for categories

Post by xnview »

no XnViewMP read metadata, and create entries in category table
Pierre.
jonha4711
Posts: 62
Joined: Mon Feb 08, 2016 4:35 pm

Re: Milking the database for categories

Post by jonha4711 »

xnview wrote:no XnViewMP read metadata, and create entries in category table
Sure. But what happens I simply overwrite the Meta blob with the data saved earlier? (Remember that my question implied that the photos and therefore also the metadata are unchanged.)

Alternatively, if you either add a method to save and restore the categories part of the metadata or make the synchronisation between database categories and XMP tags more reliable, then I'd not need to jump through any of those hoops.
User avatar
xnview
Author of XnView
Posts: 46238
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Milking the database for categories

Post by xnview »

a problem of sync between metadata and categories
Pierre.
jonha4711
Posts: 62
Joined: Mon Feb 08, 2016 4:35 pm

Re: Milking the database for categories

Post by jonha4711 »

Well, I am at a complete loss then as how to work reliably with categories. How can I can add complex category information to 25,000+ photos without a sensible restoration strategy? In principle, the XMP export should work but in practice this is, in the current implementation, much too brittle to trust.

A real pity, because in all other respects XnViewMP fits the bill.
User avatar
xnview
Author of XnView
Posts: 46238
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Milking the database for categories

Post by xnview »

you would like to recreate the database with categories?
Pierre.
jonha4711
Posts: 62
Joined: Mon Feb 08, 2016 4:35 pm

Re: Milking the database for categories

Post by jonha4711 »

xnview wrote:you would like to recreate the database with categories?
Basically yes. Most, if not all, metadata in the database can be re-created if the database has to be rebuilt -- with the exception of categories (whose creation is extremely time consuming if you have many thousand images). These are gone because they are not stored anywhere else. XMP tags would be a way out, though less than ideal, if they worked. As I've written elsewhere by far the best option would be a text file export facility so that a text file with filename/categories is created which, after recreating the database, can be re-imported.

This whole crazy idea of saving the Meta blob is just a desperate attempt to keep the categories safe in case the database has to be rebuilt.
User avatar
xnview
Author of XnView
Posts: 46238
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Milking the database for categories

Post by xnview »

jonha4711 wrote:As I've written elsewhere by far the best option would be a text file export facility so that a text file with filename/categories is created which, after recreating the database, can be re-imported.
ok, so a way to save in readable way the full category table?
Pierre.
jonha4711
Posts: 62
Joined: Mon Feb 08, 2016 4:35 pm

Re: Milking the database for categories

Post by jonha4711 »

xnview wrote:
jonha4711 wrote:As I've written elsewhere by far the best option would be a text file export facility so that a text file with filename/categories is created which, after recreating the database, can be re-imported.
ok, so a way to save in readable way the full category table?
Yes, the categories as defined for all images in the database, NOT the list categories itself (this is already possible).

See also http://newsgroup.xnview.com/viewtopic.p ... 21#p131918 and http://newsgroup.xnview.com/viewtopic.p ... 60#p130660
User avatar
xnview
Author of XnView
Posts: 46238
Joined: Mon Oct 13, 2003 7:31 am
Location: France
Contact:

Re: Milking the database for categories

Post by xnview »

could you contact me by PM
Pierre.
Post Reply