Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extracting development settings of images #3

Open
l-salewski opened this issue Jan 5, 2023 · 1 comment
Open

Extracting development settings of images #3

l-salewski opened this issue Jan 5, 2023 · 1 comment

Comments

@l-salewski
Copy link

I am currently trying to identify duplicate virtual copies which lightroom created after some partially failed catalog imports. These copies should be identical (almost) all aspects, most importantly the development settings.
So far I have identified a number of virtual copies which are identical according to a number of columns that I can access with this tool (e.g. "rating", "colorlabel", "keywords", "dims", "caption", "creator", "latitude", "longitude", "pubname"). However, this does not differentiate between virtual copies which only differ in their development settings.

Thus, it would be nice to also access image development settings like exposure and white balance. Therefore, I am kindly asking whether this would be possible?

@fdenivac
Copy link
Owner

fdenivac commented Jan 7, 2023

Unfortunately, it's not that simple: indeed the development parameters are all stored in the xmp field (a string in Extensible Metadata Platform format) of the Adobe_AdditionalMetadata table.
It is therefore not possible to access a particular setting by SQL queries.
But you may be able to draw inspiration from the code below to achieve your goals...

import sys
import hashlib
from lrtools.lrcat import LRCatDB, LRCatException
from lrtools.lrselectgeneric import LRSelectException

try:
    lrdb = LRCatDB(r"F:\Lightroom\work.lrcat")
    rows = lrdb.lrphoto.select_generic("master", "vcopies=true").fetchall()
    print(f"{len(rows)} virtual copies")
    # get all masters
    masters = [
        row[0]
        for row in lrdb.lrphoto.select_generic("master", "vcopies=true").fetchall()
    ]

    for master in masters:
        master_name, xmp = lrdb.lrphoto.select_generic(
            "name, xmp", f"id='{master}'"
        ).fetchone()
        hash = hashlib.md5(xmp.encode("utf-8")).hexdigest()
        print(f"Master | {master_name} |  | {hash}")

        for idphoto, short_name, vname, xmp in lrdb.lrphoto.select_generic(
            "id, name, vname, xmp", f"vcopies='{master}'"
        ).fetchall():
            hash = hashlib.md5(xmp.encode("utf-8")).hexdigest()
            print(f"Virtual copy | {short_name} | {vname} | {hash}")

except (LRCatException, LRSelectException) as _e:
    sys.exit(" ==> FAILED: %s" % _e)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants