RhetTbull / osxphotos

Python app to work with pictures and associated metadata from Apple Photos on macOS. Also includes a package to provide programmatic access to the Photos library, pictures, and metadata.
MIT License
1.76k stars 93 forks source link

Add live video state to PhotoInfo #1514

Open RhetTbull opened 1 month ago

RhetTbull commented 1 month ago
          > question1: does anybody knows where that property is stored in Photos.sqlite?

I used the osxphotos snap and osxphotos diff tools (which are hidden -- not listed in the help unless you use OSXPHOTOS_SHOW_HIDDEN=1) to perform a snapshot of the database before and after changing a photo's live photo on/off status which shows:

Live Video on: ZASSET table: ZPLAYBACKSTYLE=3, ZVIDEOCPVISIBILITYSTATE=0

Live Video off: ZASSET table: ZPLAYBACKSTYLE=1, ZVIDEOCPVISIBILITYSTATE=15

When Live Video turned back on: ZASSET table: ZPLAYBACKSTYLE=3, ZVIDEOCPVISIBILITYSTATE=10

These are not currently exposed in OSXPhotos.

question2: Is there a way to force Photos to commit recent changes to the database?

You cannot do this. You need to use a SQLite viewer that understands WAL mode. I like DB Browser for SQLite. I also recommend you ALWAYS copy the Photos.sqlite and the -shm and -wal files before viewing them. You risk corruption if you open them directly from the Photos library.

Originally posted by @RhetTbull in https://github.com/RhetTbull/osxphotos/issues/1513#issuecomment-2054112767