Skip to content

Set of tools for importing photo and video files into specified folder organizing them according to the date and time information. Import files and albums from Google Photo is also supported

License

Notifications You must be signed in to change notification settings

brighteyed/import-media-files

Repository files navigation

import-media-files

Set of tools for importing photo and video files into specified folder organizing them according to the date and time information. Import files and albums from Google Photo is also supported.

Tools

  • import_photo.py
usage: import_photo.py [-h] [--src-dir SRC_DIR] [--out-dir OUT_DIR]
                       [--log-file LOG_FILE]

Import photos (*.jpg; *.jpeg) into a specified folder organizing them according to EXIF tags.

optional arguments:
  -h, --help           show this help message and exit
  --src-dir SRC_DIR    directory containing photos (*.jpg; *.jpeg)
  --out-dir OUT_DIR    destination directory
  --log-file LOG_FILE  output file for imported photos list
  • import_video.py
usage: import_video.py [-h] [--src-dir SRC_DIR] [--out-dir OUT_DIR]
                       [--log-file LOG_FILE]

Import videos (*.mp4; *.mov; *.mpg) into a specified folder organizing them according to "creation_time" information found in any of its media streams.

optional arguments:
  -h, --help           show this help message and exit
  --src-dir SRC_DIR    directory containing videos (*.mp4; *.mov; *.mpg)
  --out-dir OUT_DIR    destination directory
  --log-file LOG_FILE  output file for imported videos list
  • create_albums_metadata.py
usage: create_albums_metadata.py [-h] [--takeout-dir TAKEOUT_DIR]
                                 [--out-dir OUT_DIR]

Create <UUID>.json file for each album with title, date and time, list of files, etc. As an input, it takes metadata.json that is generated by Google Photos.

optional arguments:
  -h, --help            show this help message and exit
  --takeout-dir TAKEOUT_DIR
                        Google Photos takeout directory
  --out-dir OUT_DIR     destination directory
  • create_albums.py
usage: create_albums.py [-h] [--src-dir SRC_DIR] [--out-dir OUT_DIR]

Copy media files into folders (one folder per album) according to album descriptions provided in <UUID>.json files.

optional arguments:
  -h, --help         show this help message and exit
  --src-dir SRC_DIR  directory containing imported photos, videos and albums
                     metadata files
  --out-dir OUT_DIR  destination directory for albums
  • revert_import.py
usage: revert_import.py [-h] [--files-dir FILES_DIR]
                        [--log-files LOG_FILES [LOG_FILES ...]]

Delete previously imported files. It uses log files that were generated while importing.

optional arguments:
  -h, --help            show this help message and exit
  --files-dir FILES_DIR
                        directory with photo and video files
  --log-files LOG_FILES [LOG_FILES ...]
                        log files that were generated during import
  • immich_archive_files.py
usage: archive_files.py [-h] [--metadata METADATA] [--immich-url IMMICH_URL] [--api-key API_KEY] 

Mark files as archived in Immich

optional arguments:
  -h, --help            show this help message and exit
  --metadata METADATA   path to archive metadata file (same format as json for album description)
  --immich-url IMMICH_URL
                        Immich server URL
  --api-key API_KEY     Immich API key
  • immich_create_albums.py
usage: immich_create_albums.py [-h] [--metadata-dir METADATA] [--immich-url IMMICH_URL] [--api-key API_KEY] 

Create albums in Immich according to metadata files

optional arguments:
  -h, --help               show this help message and exit
  --metadata-dir METADATA  path to directory with album description metadata files
  --immich-url IMMICH_URL  Immich server URL
  --api-key API_KEY        Immich API key

Dependencies

import_video.py and create_albums_metadata.py need ffprobe being available via PATH.

Docker

It is possible to build a docker image for import_photo.py and import_video.py tools:

Build image:

docker build --file .\docker\Dockerfile --tag import_files .

Run import:

docker run -it --rm -v /path/to/source/dir:/source -v /path/to/output/dir:/output -v /path/to/logs/dir:/logs import_files

About

Set of tools for importing photo and video files into specified folder organizing them according to the date and time information. Import files and albums from Google Photo is also supported

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published