From 34fda8bcbc789308706c09daf1290d05b5feb7dd Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Wed, 19 Jul 2023 05:30:25 -0700 Subject: [PATCH] Added more info to debug-dump --dump photos (#1124) --- osxphotos/cli/debug_dump.py | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/osxphotos/cli/debug_dump.py b/osxphotos/cli/debug_dump.py index 2b1c12b8..cae95f0f 100644 --- a/osxphotos/cli/debug_dump.py +++ b/osxphotos/cli/debug_dump.py @@ -93,13 +93,25 @@ def debug_dump( pprint.pprint(photosdb._dbpersons_fullname) elif attr == "photos": photos = photosdb.query(options=query_options) - uuid = [photo.uuid for photo in photos] - for uuid_ in uuid: - print(f"_dbphotos['{uuid_}']:") + for p in photos: + # print info on each photo + # catch any errors and continue (because if we're using debug-dump, it might be because of an error) + print(f"photo: {p.uuid}") + print(f"_dbphotos['{p.uuid}']:") try: - pprint.pprint(photosdb._dbphotos[uuid_]) + print(photosdb._dbphotos[p.uuid]) except KeyError: - print(f"Did not find uuid {uuid_} in _dbphotos") + print(f"Did not find uuid {p.uuid} in _dbphotos") + print("PhotoInfo:") + try: + print(p.asdict(shallow=False)) + except Exception as e: + print(f"Error dumping PhotoInfo.asdict(): {e}") + print("ZASSET") + print(p.tables().ZASSET.rows_dict()) + print("ZADDITIONALASSETATTRIBUTES") + print(p.tables().ZADDITIONALASSETATTRIBUTES.rows_dict()) + print("-" * 40) else: try: val = getattr(photosdb, attr)