I'm reading .lrcat data using a python script and sqlite3. I have a column in the Adobe_AdditionalMetadata table called xmp with an odd encoding, probably an Adobe Lightroom encoding. Here's my chunk of code:
from libxmp import XMPFiles
cursor = conn.execute('SELECT xmp FROM Adobe_AdditionalMetadata')
row = cursor.fetchone()
xmp_data = row[0]
xmp_data.decode('utf-8')
I tried some .decode('utf-8') or trying to convert the byte to string but didn't work. I know there's the exiftool but I dont see any ways to decode the xmp_data. Apparently, it helps reading xmp files but not the data in the catalog... Any ideas of what i could try? Something with LR API's maybe?
I found a workaround for this actually without python code. My initial goal here was to be able to make the bridge between the name of my DNG file and its file metadata such as the tint, exposure, etc. I finally found I could do this using a SQL query on the .lrcat that looks like this :
SELECT AgLibraryFile.id_global as dngID, Adobe_imageDevelopSettings.text as metadata
FROM AgLibraryFile
JOIN Adobe_images ON AgLibraryFile.id_local = Adobe_images.rootFile
JOIN Adobe_imageDevelopSettings ON Adobe_images.developSettingsIDCache = Adobe_imageDevelopSettings.id_local;