jmathai / elodie

An EXIF-based photo assistant, organizer and workflow automation tool.
https://bit.ly/introducing-elodie
Apache License 2.0
1.26k stars 139 forks source link

Sync EXIF and filesystem without issuing commands #35

Open ibizaman opened 8 years ago

ibizaman commented 8 years ago

TL;DR: what would you think about using fuse?

First of all THANK YOU. This is the project I always wanted to do - in the exact same way.

So for now, the only way to update pictures is to run the elodie.py command. I would propose to make importing and updating even more intuitive by adding fuse into the mix. This way, making a modification on the filesystem - renaming a directory, moving a file, etc. - would trigger elodie.py and automatically change the EXIF information.

The UI could then be very inuitive. Assuming:

├── 2015-06-Jun
│   ├── California
│   │   ├── 2015-06-29_16-34-14-img_3900.jpg
│   │   └── 2015-06-29_17-07-06-img_3901.jpg
│   └── Paris
│       └── 2015-06-30_02-40-43-img_3903.jpg
├── 2015-07-Jul
│   ├── Mountain View
│   │   ├── 2015-07-19_17-16-37-img_9426.jpg
│   │   └── 2015-07-24_19-06-33-img_9432.jpg

Renaming California to Silicon Valley would trigger:

./elodie.py update --location="Silicon Valley" \
    2015-06-Jun/California/2015-06-29_16-34-14-img_3900.jpg \
    2015-06-Jun/California/2015-06-29_16-34-14-img_3901.jpg

Renaming 2015-07-Jul to 2015-08 would trigger, with a bit of magick:

./elodie.py update --time="2015-08-19" 2015-07-Jul/Mountain View/2015-07-19_17-16-37-img_9426.jpg
./elodie.py update --time="2015-08-24" 2015-07-Jul/Mountain View/2015-07-24_19-06-33-img_9432.jpg

And of course, editing the EXIF information directly would also trigger corresponding ./elodie.py commands.

Python bindings for fuse can be installed with pip too: pip install fuse-python.

What do you think of this?

jmathai commented 8 years ago

What do you think of this?

Definitely think it's a great idea. Can you explain in more detail how it would work?

ibizaman commented 8 years ago

Great. So first from a user perspective. Assuming we know what fuse is, the first step is to mount the filesystem:

elodie-fs "/where/my/photos/are" "/where/i/want/my/photos/to/go"
# equivalent to:
./elodie.py import --source="/where/my/photos/are" --destination="/where/i/want/my/photos/to/go"

From now on, renaming or moving a file or directory will issue an elodie.py command under the hood. Of course, not all rename or move are meaningful so some will be denied by elodie-fs. Allowed ones are those given previously.

From a technical point of view, it is as simple as implementing all needed system call callbacks. I could not explain it better than http://www.stavros.io/posts/python-fuse-filesystem/ which is based on https://github.com/terencehonles/fusepy.

jmathai commented 8 years ago

You mainly see that happening in the write and create methods?

Besides identifying which operations should be ignored it seems quite doable. I can create a branch to develop this feature on to see where t goes.

jmathai commented 8 years ago

@ibizaman I pushed a branch gh-35-fs-sync that I'll keep rebased with master for this work.

ibizaman commented 8 years ago

Awesome! I made a little tweak to the given example in the aforementioned link: https://gist.github.com/ibizaman/e3609e01abd48e7bd605. Now it prints all arguments, making it easy to know what happens.

jmathai commented 8 years ago

@ibizaman sounds good. You can keep a PR open and push commits as they come available. I'll make sure that the @travisci and @scrutinizer jobs are hooked into this branch so we make sure changes here don't break existing code. I'll merge PRs once they look good and open can open another.