SyncPhotos Agent scans your iPhoto Library's
AlbumData.xml
file, which contains an entry for every
photo and video in your library (except for "hidden" photos). For each
"Item" (photo or video) there's an entry like this:
<key>31637</key>
<dict>
<key>MediaType</key>
<string>Image</string>
<key>Caption</key>
<string>IMG_0484</string>
<key>Comment</key>
<string></string>
<key>GUID</key>
<string>32CE8F30-A9F9-484E-9E2E-4BB2383739CC</string>
<key>Aspect Ratio</key>
<real>1.333333</real>
<key>Rating</key>
<integer>0</integer>
<key>Roll</key>
<integer>31733</integer>
<key>DateAsTimerInterval</key>
<real>306673931.000000</real>
<key>ModDateAsTimerInterval</key>
<real>306673931.000000</real>
<key>MetaModDateAsTimerInterval</key>
<real>309395051.193756</real>
<key>ImagePath</key>
<string>/Users/stefan/Pictures/osaka iPhoto Library/Previews/2010/Oct 18, 2010/IMG_0484.jpg</string>
<key>OriginalPath</key>
<string>/Users/stefan/Pictures/osaka iPhoto Library/Masters/2010/Oct 18, 2010/IMG_0484.JPG</string>
<key>ThumbPath</key>
<string>/Users/stefan/Pictures/osaka iPhoto Library/Thumbnails/2010/Oct 18, 2010/IMG_0484.jpg</string>
<key>OriginalType</key><string>JPEG</string>
<key>ImageType</key><string>JPEG</string>
<key>latitude</key><real>42.50333333</real><key>longitude</key><real>-71.08083333</real>
<key>RotationIsOnlyEdit</key>
<true/>
</dict>
If the Item has an "OriginalPath" value, that's used as the Item's original path and the "ImagePath" value is used as the Item's modified path. Otherwise, "ImagePath" is used as the Item's original path (there is no modified path because the Item hasn't been modified in iPhoto).
SyncPhotos Agent scans your computer's iPhoto Library's
AlbumData.xml
for entries like the above. It writes its own data
file called albumData.dat
. For each Item,
albumData.dat
contains the SHA1 checksum of the original file, the
SHA1 of the modified file (if any), the iPhoto key, the path to the original,
the path to the modified (if any), etc.
SyncPhotos uses Bonjour finds SyncPhotos Agents running on other computers on the local network, and displays a list of them in the source list (the left-hand column) of the app.
When you click on another computer in SyncPhotos, it compares your
albumData.dat
to the other computer's albumData.dat
to find Items that you don't have:
It loads the set of "unwanted SHA1s". This includes:
library_sha1s.dat
in
your Application Support folder)ignored_sha1s.dat
in your Application Support folder)received_sha1s.dat
in your
Application Support folder)It gets the set of SHA1s of the original versions of the other computer's Items (SyncPhotos only retrieves originals). It subtracts the set of "unwanted SHA1s" from this set. For the remaining SHA1s, SyncPhotos:
albumData.dat
It then shows that list of "wanted Items" in the UI under "Manually import new photos and videos".
If you click "Import All" or select some Items and click "Import Selected", SyncPhotos copies the selected Items (the original versions only) from the other computer to your computer, placing them in a folder within the Application Support folder and resetting their last-modified dates to the dates they had on the other computer.
Once all Items are copied, it imports them all into your iPhoto Library via
AppleScript. As each Item is imported, its SHA1 is appended to the
received_sha1s.dat
file described above. When all Items are
imported, SyncPhotos displays a Growl notification stating how many Items have
been retrieved.
If you select a computer and check "automatically import" (read Automatically Syncing Photos for more details), SyncPhotos Agent follows much the same logic as described in Manual Sync above.
Whenever SyncPhotos Agent notices that the AlbumData.xml
file
has been rewritten (iPhoto rewrites it periodically while running and always
when it quits), SyncPhotos Agent rescans that AlbumData.xml
file,
updates its albumData.dat
file (its catalog), and updates the "TXT
record" associated with its Bonjour network presence.
SyncPhotos Agent on every other computer detects this TXT-record update. If a SyncPhotos Agent is configured to automatically sync from that computer with the TXT-record update, the SyncPhotos Agent connects to that computer to get its updated catalog, and compares its own catalog to that computer's catalog using the same process as described in Manual Sync above. It then retrieves any new Items.