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 hashes)

Uploaded source

Built Distribution

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page