tag_images_for_google_drive¶
Manage tags and descriptions in image files to be indexed by Google Drive
Warning
WARNING: It’s not a released version !
Tag images for google drive documentation¶
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
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).
Make commands¶
The Makefile contains the central entry points for common tasks related to this project.
make help
will print all majors targetmake configure
will prepare the environment (conda venv, kernel, …)make lint
will lint the codemake test
will run all unit-testsmake typing
will check the typingmake add-typing
will add annotation for typingmake validate
will validate the version before commitmake clean
will clean current environmentmake docs
will create and show a HTML documentation in ‘build/’make dist
will create a full wheel distribution
Twine commands¶
make check-twine
will check the packaging before publicationmake test-twine
will publish the package intest.pypi.org <https://test.pypi.org>
_)make twine
will publish the package inpypi.org <https://pypi.org>
_)
Docker commands¶
make docker-build
will build the Dockerfile and containermake docker-run
will start the container in background and attach the consolemake docker-start
will start the container in backgroundmake docker-stop
will stop the containermake docker-attach
will attach the console to the containermake docker-bash
will attach a shell in the container
Contribute¶
The code use Conda , because we want some dependencies other than Python.
Download sources
$ git clone |giturl| tag_images_for_google_drive
then:
On Windows, use the Ubuntu subsystem, then install minicoda:
$ wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh
$ .//Miniconda3-latest-Linux-x86_64.sh
then: .. code-block:: bash
$ cd tag_images_for_google_drive $ conda install -y -c anaconda make $ make configure $ conda activate tag_images_for_google_drive $ make installer
- A
make validate
is executed before agit push
in branchmaster
. It possible to force the push withFORCE=y git push
.