sortphotos
sortphotos copied to clipboard
Add several option to support file_watcher, notification center and foreign language
Hello,
These patch add several option I found usefull: --set-locale fr_FR to force a locale, thus directory name created match the locale user need --ignore to ignore a list of specific file like .* or .db (.* was ever supported in the script) but since I imported directory from windows got a lot of annoying Thumb.db files that were parsed by exiftool... --remove-ignored-files option remove ignored files, the idea is to be able to get a clean source directory once file have been processed and moved --remove-empty-dirs option to remove empty dirs in source dir once it has been processed
With all these option it is possible to put file in a dir and a script can process the dir. Once the dir is processed it can be completely cleaned up for next data incomming.
This bring us to the two new script file_watcher.py and sort_filter.py. The file_watcher is a script that use filewatch a cross platfrom directory watcher. Once file are put into the dir the sort_filter is called with the files added as argument, allowing to automagically sort your photos :)
disclaimer: This is initial version that do not use yet the new options. A future version will come with new options support to improve speed and corner cases.
Laurent
Added file_watcher script, when a file is put in the watched directories the sorting is automatically launched once no more activity is detected on them.
Use fswatch from https://github.com/emcrisostomo/fswatch Added option -w,--watch to make sortphoto wait on it's standard input new files to analyze.
Added a plist file to launch the file_watch script on user session login. Every time a file is put in incoming_directory, after 30s of inactivity the directory is sorted and files are moved to sorted_directory.
Work done, the file watcher does not impact computer speed. After 5 seconds of inactivity, the photos are sorted automagically and a notification is displayed in notification center. If user click on banner, the output dir is displayed
Here the banner result:
@nekopep Great stuff. But there are too many things for me to pull all at once. Some of them have been superseded by other pull requests or are of lower priority. If you make separate pull requests for each change (each pull request doing only one thing) then it is more likely that I can accept more of them. Sorry for the hassle. I understand if you don't want go to the trouble of doing that. If not, I may try pull a few things out myself and you've made some nice changes.