Example #1
0
        for infodict in self._photos.values():
            photo = Photo(infodict)

    def extract_albums_and_events(self):
        """Extract info on albums and events from the albumdata.

        Filter out the ones we don't want.
        """
        logger.debug("Found %s albums/events in total.",
                     len(self._albums_and_events))
        for infodict in self._albums_and_events:
            album_type = infodict['Album Type']
            if album_type == 'Regular':
                album = Album(infodict)
            elif album_type == 'Event':
                event = Event(infodict)
            elif album_type == 'Folder':
                event = Event(infodict)
            else:
                # 'Smart'
                logger.debug("Unused album type: %s", album_type)


if __name__ == '__main__':
    iphoto_location = utils.absolute_expanded_path(
        '~/Pictures/iPhoto Library')
    iphoto = Iphoto(iphoto_location)
    iphoto.read()
    iphoto.extract_albums_and_events()
    iphoto.extract_photos()