A simple use of exif data with python to group pics by places and periods. A good partner for people who have just too many files to sort !
- Pip
- Exiftool by Phil Harvey (needs to be in the root directory)
- The googlemaps package
$ pip install -U googlemaps
Once you download file_sorter.py, open it with your favorite text-editing sofware.
Now go get your own API key here and past it in gmaps_key
.
Change the dir_path
to the directory which contains all your pics without any subdirectory.
Other editable values:
distance_max
: the maximum distance before spliting an eventduration_max
: the maximum duration before spliting an eventMonth
: edit it for you own languageis_nonGPS_allowed
: allow files with no GPS data (only creation date)is_nonGPS_merge_allowed
: allow events with same date and no GPS data to merge
Don't forget to make a backup first.
Execute it like a basic .py program
The program collect the GPS
and CreationDate
data of all files in dir_path using Exiftool.
Then, it test the distance and the duration between each: if it's higher than distance_max
or duration_max
, it groups all the previous matching files into one folder, named by the place and the period.
Any improvement will be greatly appreciated. If you have a faster way to get exif data from pics / mov files, feel free to contribute !
- Mathieu Menoux - Initial work
This project is licensed under the MIT License - see the LICENSE.txt file for details
- A big thanks for the awesone Exiftool
- Hat tip to anyone who's code was used