Skip to content

"If your pictures aren't good enough, you're not close enough." — Robert Capa

Notifications You must be signed in to change notification settings

zebooka/photos-downloader

Repository files navigation

README

"If your photographs aren't good enough, you're not close enough." — Robert Capa.

Author

Installation

Run make to get list of all commands. make all will create environment, run tests and build application. Add build/photos-downloader.phar to directory within your executable path. For example, add it to /usr/local/bin/ directory. Set executable flag — chmod +x photos-downloader.phar.

Requirements

You need Docker to build photos-downloader tool. You need to install exiftool (version ≥ 9.33) as well. This program is used to read exif from photos.

VLC Media Player (VideoLAN Client)

In order to process snapshots from VLC, you need to change its configure slightly. Go to settings and in Video section set Video snapshots -> Prefix option to vlc_$N_$T_ and check Sequential numbering option.

Important! Before taking snapshots you need to process video files with this tool in order to rename them to correct format. This is needed for VLC to save original filename in snapshot file name, because snapshots do not have EXIF metadata and this tool will be unable to detect date/time, camera and author name.

Usage

photos-downloader.phar -t PATH [options] FROM_PATH [ FROM_PATH ... ]

Run photos-downloader.phar -h to get full options list.

License

Standard MIT License — http://opensource.org/licenses/MIT

https://zebooka.com/soft/LICENSE/

Copyright (c) 2022, Anton Bondar zebooka@gmail.comhttps://zebooka.com/

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

Algorythm

  1. Create two heaps — one for directories list, one for files list.
  2. If one of from paths was dash "-" and both heaps are empty, then read line from STDIN and add this file/directory to its heap.
  3. If files heap is empty, then take directory from directories heap and scan it. Add files/directories to their heaps. Do this until file heap is empty or no more directories left in their heap. If no-recursive option is set, then found directories are not added to their heap. Also directories are added to the beginning of their heap.
  4. Take file (or photo bunch) from files heap and process it. Photo bunch is a set of files with same basename, but different extensions. They are processed simultaneously and moved/copied at once.
  5. Guess camera and date/time from file exif. If these parameters differ for photos in photo bunch, then issue a warning and skip this photo bunch (unless special -B flag is set).
  6. Analyze basename of file (photo bunch) and guess date/time, shot, author, camera, known tokens, other tokens from it.
  7. Overwrite exif detected camera and date/time by ones detected from basename.
  8. Drop and add known/other tokens according to configured parameters.
  9. Assemble destination directory. Can be either same directory if files are kept in place, specified directory or specified directory with Year/Month subdirectories structure (format can be changed in configure).
  10. Assemble new basename for file (photo bunch) and check if it is already taken in destination directory. Basename pattern is assembled of (in this exact order) — prefix, date, time, shot, author, camera, known tokens, other tokens. Newly added tokens are placed at the end of known or other tokens lists.
  11. If there are some files with assembled basename in destination directory, verify their hashes with processed ones.
  12. If there are no files with same extensions in destination directory and in processed photo bunch, then consider basename as taken.
  13. If at least one of files have different hashes, then consider basename as taken.
  14. If basename considered taken, then increase shot number and repeat procedure (from step 10).
  15. Move/copy file (photo bunch).

About

"If your pictures aren't good enough, you're not close enough." — Robert Capa

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages