Skip to content

rharder/pyphotofs

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

61 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pyphotofs: iPhoto File System with FUSE and Python

This tool mounts an iPhoto library as a filesystem with Albums and Rolls as folders within.

Example Usage

mount_iphotofs.py ~/Pictures/iPhoto\ Library.photolibrary

Without specifying a mount point, it will try to make a reasonable mount point based on the library name and in a location native to the operating system. On a Mac you might get a folder structure like so:

$ tree /Volumes/iPhoto\ Library
/Volumes/iPhoto\ Library
├── Albums
│   ├── Apr\ 24,\ 2012
│   │   ├── IMG_1201.JPG
│   │   ├── IMG_1202.JPG
│   │   ├── IMG_1203.JPG
│   │   ├── IMG_1204.JPG
│   ├── Flagged
│   ├── Last\ 12\ Months
│   │   └── IMG_1204.JPG
│   ├── Last\ Import
│   │   ├── IMG_1203.JPG
│   │   ├── IMG_1204.JPG
│   └── Photos
│   │   ├── IMG_1201.JPG
│   │   ├── IMG_1202.JPG
│   │   ├── IMG_1203.JPG
│   │   ├── IMG_1204.JPG
└── Rolls
    └── Apr\ 24,\ 2012
│   │   ├── IMG_1201.JPG
│   │   ├── IMG_1202.JPG
│   │   ├── IMG_1203.JPG
│   │   ├── IMG_1204.JPG

Installation

After installing the other required software (mentioned below), copy mount_iphotofs.py and mount_iphotofs (just a symbolic link to help the native mount command) to wherever your platform keeps all the other mount_xxxx commands, probably /sbin.

Requirements

This tool relies on plistlib to read the AlbumData.xml file within the iPhoto library folder, fusepy to interface with FUSE, and some host-supported implementation of FUSE itself.

Required software:

With mount Command

If you copy/link (link may be better) mount_iphoto.py to /sbin/mount_iphotofs (depending on your platform) you can use your native mount command with something like this:

mount -t iphotofs ~/Pictures/iPhoto\ Library.photolibrary /media/photos

I have not tried it yet, but you could probably add it to your /etc/fstab file as well.

To Do

I like the idea of having a Faces folder with a sub folder for each face known to iPhoto. This would involve some sqlite scripting, which I do not think requires any extra dependencies in Python. Perhaps I will get around to adding this feature in the future.

Caveats

This is just something I threw together over a few days to serve my own purposes, but if it is of use to anyone else, please enjoy it. I do not know where the code is broken or under what conditions something will break. I do know that I mount the filesystem read-only, so that should reduce the possibility of totally destroying your iPhoto library.

Other Uses

This tool consists of a few classes to help read iPhoto libraries. These classes may be of use outside of the purpose of mounting the library as a filesystem. Feel free to extract these classes and use them in your own product.

For instance you might copy and paste the classes into your own script to list album names in a library:

lib = iPhotoLibrary('~/Pictures/iPhoto Library.photolibrary')
for a in lib.albums():
    print('%s (%d)' % (a.name(), a.num_images())

and you might get output like so:

Photos (8)
Flagged (0)
Last 12 Months (1)
Last Import (8)
Apr 24, 2012 (8)

Credits

Created by Robert Harder, rob iharder.net, and released into the Public Domain.

About

iPhoto File System with FUSE Python

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages