Can a script find out if a file has metadata writeback pending?

Started by ubacher, February 16, 2019, 06:37:03 PM

Previous topic - Next topic

ubacher

Since a metadata write-back can cause metadata to change, a script should not read (certain) metadata if a write-back is outstanding.
Is there a way to know if a write-back is pending ("yellow pencil")?

I just thought of one way: checking if the file is part of the collection of pending write-back files. Any other, more direct ways?

Mario

Just access the pending writeback collection in your script.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook

ubacher

But, if I understand it right, the collections are updated in the background. This means I would need to know first if the updating
of the collections is finished before I can rely on it.

Mario

Yep. This is the way things work in modern applications. IMatch is doing many things at the same time.
You can monitor for the corresponding events in your app and then act accordingly.

Or you fetch all files and iterate over them in a loop to check for their pending state.

Keep in mind that, while your app is doing this, the user or a background task may change the pending state.
Unlikely, but may happen. It all depends on your app and in which situation you run it.
Everything is temporary. IMatch may be rescan a folder while your app is running, bring in new and updated files into the database. And this, often, produces new files with pending metadata. All you will have in your app is a snapshot at a certain point in time.
-- Mario
IMatch Developer
Forum Administrator
http://www.photools.com  -  Contact & Support - Follow me on 𝕏 - Like photools.com on Facebook