Skip to main content

Manage tags and description to be indexed by Google Drive

Project description

README

Motivation

Synchronize a CSV database and PNG/JPEG files to add #hashtag in image description. Then, you can synchronize all files with Google drive and search image with tags. Google set the metadata of the file from the 'description' metadata in graphic file.

Synopsis

Google drive use only the description meta-data to index an image. After this synchronisation it's possible to search an image with "type:image a_hashtag".

type:image apple

This tool use Exiftool

$ sudo apt-get install exiftool        # Debian
$ sudo brew install exiftool           # Mac
$ sudo yum install perl-Image-ExifTool # CentOS
...
...

You can update the tags inside the description in your CSV file, or use some others tools like XnView and extract tags to CSV and descriptions.

By default, this tool merge the tags from CSV and files.

$ # Merge tags from descriptions.csv and selected files, and save all tags in tags.txt
$ tag_images_for_google_drive -v --db descriptions.csv '**/*.png' '**/*.jpg' \
--tagfile tags.txt

But it's possible to apply tags from database or files only

$ tag_images_for_google_drive -v --from-db   --db descriptions.csv '**/*.png' '**/*.jpg'
$ tag_images_for_google_drive -v --from-file --db descriptions.csv '**/*.png' '**/*.jpg'

To add a specific tag for all images in a directory, add it in command line.

$ tag_images_for_google_drive -v --db descriptions.csv -t myimages '**/*.png' '**/*.jpg'

The, you can filter theses specifics images with type:image myimages ....

For more informations

$ tag_images_for_google_drive --help

or read the documention

To synchronize the google files, you can use different tools. In the proposed Docker image, we use the google-drive-ocamlfuse.

The latest version

Clone the git repository (see upper button)

Installation

Different solutions is possible.

For windows

Use chcp 16001 (utf-8), before use this tools.

Installation from one executable

  • Copy the file 'tag_images_for_google_drive.${OS}' to local directory
  • Rename this file to 'tag_images_for_google_drive'
  • And run-it
$ tag_images_for_google_drive --help

Installation from PIP

  • In virtualenv or conda env, use
$ pip install tag_images_for_google_drive
  • Then, run-it
$ tag_images_for_google_drive --help

Installtion in Docker

  • From the source code, use make Dockerfile
  • WARNING, this image have the credential for manipulate all yours Google files
  • Eventually, create a dedicated volume for the GDrive cache
> docker volume create --name tag_image_for_google_drive
  • Create the container with custom parameters
$ docker build \
-f Dockerfile \
--build-arg OS_VERSION="latest" \
--build-arg GDRIVE_ROOT_FOLDER="/Images" \
--build-arg GDRIVE_TEAM_DRIVE_ID="" \
--build-arg PARAMS="'**/*.png' '**/*.jpg'" \
--build-arg CRON_FREQUENCE="* */12 * * *" \
-t "$(USER)/tag_image_for_google_drive:latest" .
  • Start the container
$ docker run --detach --cpus=0.5 \
--privileged \
-v tag_image_for_google_drive:/cache
-i "$(USER)/tag_image_for_google_drive:latest"

Inside the container, a google-drive-ocamlfuse is installed to synchronize the google files from GDRIVE_ROOT_FOLDER in the cache, and a crontab is periodically executed (see CRON_REQUENCE) to invoke tag_image_for_google_drive with PARAMS.

Installation from source

Go inside the directory and

$ make configure
$ conda activate tag_images_for_google_drive
$ make install

Tests

To test the project

$ make test

To validate the typing

$ make typing

To validate all the project

$ make validate

Project Organization

├── Makefile              <- Makefile with commands like `make data` or `make train`
├── README.md             <- The top-level README for developers using this project.
├── docs                  <- A default Sphinx project; see sphinx-doc.org for details
├── setup.py              <- makes project pip installable (pip install -e .[tests])
│                            so sources can be imported and dependencies installed
├── tag_images_for_google_drive                <- Source code for use in this project
└── tests                 <- Unit and integrations tests ((Mark directory as a sources root).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tag_images_for_google_drive-1.1.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

tag_images_for_google_drive-1.1-py3-none-any.whl (21.0 kB view details)

Uploaded Python 3

File details

Details for the file tag_images_for_google_drive-1.1.tar.gz.

File metadata

File hashes

Hashes for tag_images_for_google_drive-1.1.tar.gz
Algorithm Hash digest
SHA256 b9b82592a74035f56bd4b3c20369b58d9693646508fd3a65e302e39501cc237e
MD5 7050b1895b1269a252c2c0da3ca0c6c2
BLAKE2b-256 efe54807eca653601fa846f08b3db06d8ca3d548f282afdf6b3b9fc3f965afea

See more details on using hashes here.

File details

Details for the file tag_images_for_google_drive-1.1-py3-none-any.whl.

File metadata

File hashes

Hashes for tag_images_for_google_drive-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 d659417fdaa92d89ea2858d9f0b9e3381cd1a5a3a3b58b698a2b7a847f23cd27
MD5 2822f08d3ca4fbee7ae7d718aff66aeb
BLAKE2b-256 947423d304b700d1efd8e1f52ff53c0e2ea9374e974bf38adf19a7d265a34a5c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page